Re: [PATCH] ls: print ?, not 0 as inode of dereferenced dangling symlink

2009-09-29 Thread Jim Meyering
Jim Meyering wrote: Here's another corner-case fix. I'll push something like this as soon as I've updated NEWS and added a test. From 26a1306a0a9028eceed388dad0d8916aeeb00233 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Mon, 28 Sep 2009 20:24:41 +0200 Here's a more

Re: [PATCH] ls: with -LR, exit with status 2 upon detecting a cycle

2009-09-29 Thread Jim Meyering
Pádraig Brady wrote: Jim Meyering wrote: Jim Meyering wrote: Here's a fix to make ls -LR work the same way Solaris 10's /bin/ls does in the presence of a cycle. It makes sense to exit(2) along with the printed error. The patch looks good. Thanks for the review.

Re: [PATCH] ls: don't use an undefined struct stat after failed stat/lstat

2009-09-29 Thread Pádraig Brady
Jim Meyering wrote: Nearly missed this one. ls initializes a struct stat to all NUL bytes. It calls stat or lstat on a dangling symlink, and that fails. ls then tests stat.st_ino. Sometimes, it's 0, but sometimes it's the inode of the symlink, possibly depending on how the package was

Re: [PATCH] ls: don't use an undefined struct stat after failed stat/lstat

2009-09-29 Thread Jim Meyering
Pádraig Brady wrote: Jim Meyering wrote: Nearly missed this one. ls initializes a struct stat to all NUL bytes. It calls stat or lstat on a dangling symlink, and that fails. ls then tests stat.st_ino. Sometimes, it's 0, but sometimes it's the inode of the symlink, possibly depending on

Re: [PATCH] ls: don't use an undefined struct stat after failed stat/lstat

2009-09-29 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Meyering on 9/29/2009 5:13 AM: - /* The failed stat/lstat may have modified f-stat. Clear it, - since we may use at least its st_ino member, e.g., - when trying to print the inode of dangling

Re: [PATCH] ls: don't use an undefined struct stat after failed stat/lstat

2009-09-29 Thread Jim Meyering
Eric Blake wrote: According to Jim Meyering on 9/29/2009 5:13 AM: - /* The failed stat/lstat may have modified f-stat. Clear it, - since we may use at least its st_ino member, e.g., - when trying to print the inode of dangling symlink: - mkdir d;

Re: [PATCH] ls: don't use an undefined struct stat after failed stat/lstat

2009-09-29 Thread Jim Meyering
Eric Blake wrote: According to Jim Meyering on 9/29/2009 5:13 AM: - /* The failed stat/lstat may have modified f-stat. Clear it, - since we may use at least its st_ino member, e.g., - when trying to print the inode of dangling symlink: - mkdir d;

Re: stat vs. -

2009-09-29 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Meyering on 9/15/2009 5:49 AM: But couldn't, because stat didn't accept - as meaning standard input. Here's a patch to make it do that (and make the above print what's displayed): This is just FYI. Of course I'll add the usual

Re: stat vs. -

2009-09-29 Thread Jim Meyering
Eric Blake wrote: According to Jim Meyering on 9/15/2009 5:49 AM: But couldn't, because stat didn't accept - as meaning standard input. Here's a patch to make it do that (and make the above print what's displayed): This is just FYI. Of course I'll add the usual NEWS, log and tests and

Re: stat vs. -

2009-09-29 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Meyering on 9/29/2009 6:44 AM: stat has two modes of operation: the default is to interpret each argument as a file on which to call stat or lstat. Then there's the --file-system (-f) option. The - == stdin approach makes sense

Re: stat vs. -

2009-09-29 Thread Jim Meyering
Eric Blake wrote: According to Jim Meyering on 9/29/2009 6:44 AM: stat has two modes of operation: the default is to interpret each argument as a file on which to call stat or lstat. Then there's the --file-system (-f) option. The - == stdin approach makes sense for the first case. Since I

[PATCH] stat: interpret - as standard input

2009-09-29 Thread Jim Meyering
Per recent discussion, here's all but the documentation update. From a033e28737c1f6320bfc56b484253b61051bad85 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Tue, 15 Sep 2009 23:07:18 +0200 Subject: [PATCH] stat: interpret - as standard input * src/stat.c (do_stat):

Re: stat vs. -

2009-09-29 Thread Eric Blake
Jim Meyering jim at meyering.net writes: But how would you make it work *with* -f? You don't know the path of the file used to create stdin (and in the case of a pipe, there is no path), There is no need for an actual file name, since fstatfs takes a file descriptor. Of course, there's

Re: stat vs. -

2009-09-29 Thread Jim Meyering
Eric Blake wrote: Jim Meyering jim at meyering.net writes: But how would you make it work *with* -f? You don't know the path of the file used to create stdin (and in the case of a pipe, there is no path), There is no need for an actual file name, since fstatfs takes a file descriptor. Of

Re: [PATCH]: ls: do not show long iso time format for en_* locales

2009-09-29 Thread Paul Eggert
Jim Meyering j...@meyering.net writes: However, I'm a little reluctant to change back. Let's wait a day or two, in case Paul Eggert has an objection. Here are some objections to the change, under the assumption that we're in a poorly-configured environment (as the behavior is unaffected in

Petit: log analysis tool, very unix-ish

2009-09-29 Thread Scott McCarty
All, Woudl this tool be useful/interesting to the coreutils group? It's not in C, but has some unique/novel features. When I saw the program uniq, I did a man and saw this list. I thought it might be worth a look for the group. If you are interested, I wrote it in python over the last