From: Jonathan Stowe Date: 13:09 on 04 Mar 2004 Subject: Gnu findutils So how long has samba been around, how long has Windows had long filenames and encourage people to create files with spaces in (yeah, yeah I know but that is a totally different piece of hate.) It's not entirely impossible to create filenames with spaces under Unix (why you should want to is another matter). Then why do the stupid poxy findutils not make any allowance for this and not give me: [jonathan@orpheus Documentation]$ find . -type d | xargs chmod go+rx chmod: failed to get attributes of `./Database': No such file or directory chmod: failed to get attributes of `Schema': No such file or directory chmod: failed to get attributes of `./Document': No such file or directory chmod: failed to get attributes of `System': No such file or directory chmod: failed to get attributes of `./ID': No such file or directory chmod: failed to get attributes of `generation': No such file or directory chmod: failed to get attributes of `./SCP': No such file or directory chmod: failed to get attributes of `SDK': No such file or directory and so forth. Oh yes I know there are ways to get around this. But 'find' knows it has a filename there which has a space in it and 'xargs' is designed to work with 'find' so why can't they just sort themselves out and deal with these as filenames rather than a bunch of space delimited tokens. I despair. /J\
From: peter (Peter da Silva) Date: 14:04 on 04 Mar 2004 Subject: Re: Gnu findutils > and so forth. Oh yes I know there are ways to get around this. But > 'find' knows it has a filename there which has a space in it and 'xargs' > is designed to work with 'find' so why can't they just sort themselves > out and deal with these as filenames rather than a bunch of space > delimited tokens. Because xargs has been defined to take whitespace-delimited filenames for so long that there's almost certainly someone somewhere who's got code that depends on it. Plus, it's religious. find -print0 and xargs -0 is safe, whereas fixing xargs is "merely convenient". Unless you're trying to do more than find can handle and you want to filter the output, then you discover that things like "grep" don't like nulls. If not for the religious "if we allow you to do unsafe things, you will do unsafe things" they'd define two options (eg: --newline and --whitespace) in xargs and say "until 2005/12/31 the default will be --whitespace, after that it will be --newline". So, with no further ado, try: find ... | filters | tr '\n' '\000' | xargs -0 ... If you have a "tr" that has problems with nulls, use this instead: #include <stdio.h> void nullify(FILE *, char *); void usage(void); char *prog; main(int ac, char **av) { FILE *fp = NULL; prog = strrchr(*av, '/'); if(!prog) prog = *av; while(*++av) { fp = fopen(*av, "r"); if(!fp) { perror(*av); usage(); exit(1); } nullify(fp, *av); fclose(fp); } if(!fp) nullify(stdin, NULL); exit(0); } void usage(void) { fprintf(stderr, "Usage: %s [file]...\n", prog); } void nullify(FILE *fp, char *name) { int c; while(-1 != (c = getc(fp))) { if(c=='\n') c = 0; putchar(c); } }
From: Philip Newton Date: 14:11 on 04 Mar 2004 Subject: Re: Gnu findutils On 4 Mar 2004 at 13:09, Jonathan Stowe wrote: > So how long has samba been around, how long has Windows had long > filenames and encourage people to create files with spaces in (yeah, > yeah I know but that is a totally different piece of hate.) Before Windows 95 and long filenames were around, it was the Macintosh people creating filenames with spaces... (I remember guidelines for some software which included something along the lines of "no steenking spaces in filenames", though I can't remember offhand what it was, and that bit of advice was followed by something like "Macintosh users, laugh all you want".) > Then why do the stupid poxy findutils not make any allowance for this Hysterical raisins? > [jonathan@orpheus Documentation]$ find . -type d | xargs chmod go+rx > chmod: failed to get attributes of `./Database': No such file or > directory > chmod: failed to get attributes of `Schema': No such file or directory > chmod: failed to get attributes of `./Document': No such file or > directory > chmod: failed to get attributes of `System': No such file or directory > chmod: failed to get attributes of `./ID': No such file or directory > chmod: failed to get attributes of `generation': No such file or > directory > chmod: failed to get attributes of `./SCP': No such file or directory > chmod: failed to get attributes of `SDK': No such file or directory > > and so forth. Oh yes I know there are ways to get around this. With GNU fileutils, yes (-print0 and -0 go a long way). With the standard 'find' and 'xargs', it becomes more Interesting, in the Chinese sense of the word. Yay. Philip
From: Jonathan Stowe Date: 16:22 on 04 Mar 2004 Subject: Re: Gnu findutils hate@xxxxxxxxxxxxxx.xxxxx Thu, 2004-03-04 at 14:11, Philip Newton wrote: > On 4 Mar 2004 at 13:09, Jonathan Stowe wrote: > > > So how long has samba been around, how long has Windows had long > > filenames and encourage people to create files with spaces in (yeah, > > yeah I know but that is a totally different piece of hate.) > > Before Windows 95 and long filenames were around, it was the Macintosh > people creating filenames with spaces... > Yeah and look how much hate they have been generating ... Actually I seem to recall that the Amiga let you do this too
From: Darrell Fuhriman Date: 16:30 on 04 Mar 2004 Subject: Re: Gnu findutils > Yeah and look how much hate they have been generating ... Actually I > seem to recall that the Amiga let you do this too Unix lets you do it, too, along with any number of silly things like newlines. Doesn't the hate belong with those utilities, like the shells, that assume that perfectly valid filenames are actually two (or more) files? I get pissed off when websites reject perfectly valid e-mail addresses for having a '+' in them, why should I not get pissed at utilities that barf on perfectly valid filenames? If people shouldn't use spaces in filenames, don't let them. Darrell
From: John Sinteur Date: 16:43 on 04 Mar 2004 Subject: Re: Gnu findutils On 4-mrt-04, at 17:30, Darrell Fuhriman wrote: > If people shouldn't use spaces in filenames, don't let them. > I distinctly remember a problem with an update shell script from Apple for an early Mac OS X version that would wipe your disk because the script didn't cope with spaces in file names, and whoever developed it didn't have his primary disk called "Macintosh HD" like, say, close to every other mac in existence, so he never ran into it. [insert appropiate quality testing procedures hate rant here] Now *that* was fun. But the finger pointing was at the shell script in question, not at the utilities it used. And it should be. -John
From: peter (Peter da Silva) Date: 16:38 on 04 Mar 2004 Subject: Re: Gnu findutils > > Before Windows 95 and long filenames were around, it was the Macintosh > > people creating filenames with spaces... > Yeah and look how much hate they have been generating ... Actually I > seem to recall that the Amiga let you do this too UNIX lets you do it too. And there have been applications as far back as the V6 era that did.
From: David Cantrell Date: 23:58 on 04 Mar 2004 Subject: Re: Gnu findutils Peter da Silva wrote: > UNIX lets you do it too. And there have been applications as far back as the > V6 era that did. I once created a file with a / in its name on SCO. I have no idea how, but I'd love to be able to repeat it, if only for producing pathological test data.
From: peter (Peter da Silva) Date: 00:01 on 05 Mar 2004 Subject: Re: Gnu findutils > > UNIX lets you do it too. And there have been applications as far back as the > > V6 era that did. > I once created a file with a / in its name on SCO. I have no idea how, > but I'd love to be able to repeat it, if only for producing pathological > test data. You used to be able to do that on some UNIXes from NFS clients. In particular, Macintosh NFS clients.
From: David Cantrell Date: 09:24 on 05 Mar 2004 Subject: Re: Gnu findutils On Thu, Mar 04, 2004 at 06:01:45PM -0600, Peter da Silva wrote: > > I once created a file with a / in its name on SCO. I have no idea how, > > but I'd love to be able to repeat it, if only for producing pathological > > test data. > You used to be able to do that on some UNIXes from NFS clients. In particular, > Macintosh NFS clients. I was logged in to the machine using telnet. I disremember whether I did it directly from the shell or with some bad C code. I also don't remember whether it was on an NFS mounted volume.
From: Jonathan Stowe Date: 16:45 on 05 Mar 2004 Subject: Re: Gnu findutils On Thu, 2004-03-04 at 23:58, David Cantrell wrote: > Peter da Silva wrote: > > > UNIX lets you do it too. And there have been applications as far back as the > > V6 era that did. > > I once created a file with a / in its name on SCO. I have no idea how, > but I'd love to be able to repeat it, if only for producing pathological > test data. I seem to recall that there is/was a specific case on windows whereby doing something similar would cause the file to be invisible in both explorer and 'dir', I can't replicate it here though. Mind I had an ICL DRS/NX machine that had a directory called ' ' that was a hard link to '.', I was never quite sure how that happened either. All sorts of fun ensued. /J\
From: Gavin Estey Date: 16:51 on 04 Mar 2004 Subject: Re: Gnu findutils On Mar 4, 2004, at 9:11 AM, Philip Newton wrote: > Before Windows 95 and long filenames were around, it was the Macintosh > people creating filenames with spaces... > People who put spaces in filenames fall into the same category as people who create tar files that spew their contents into the current directory, that is they'll all be first against the wall when I'm king. Gavin.
Generated at 10:28 on 16 Apr 2008 by mariachi