Re: Change in behavior to stat(1)

2011-03-05 Thread Doug Barton
t;$link" ] || unlink $link' but Jilles is definitely right that simply using 'test -e' is the way to go. Stephen, sorry to hear that the change in behavior to stat(1) was troubling to you. A little bit of the history might be useful. I originally imported stat(1) from NetBSD in

Re: Change in behavior to stat(1)

2011-03-04 Thread Jilles Tjoelker
On Mon, Feb 28, 2011 at 11:15:39AM -0600, Stephen Montgomery-Smith wrote: > I had a little script that would remove broken links. I used to do it > like this: > if ! stat -L $link > /dev/null; then rm $link; fi > But recently (some time in February according to the CVS records) stat > was chan

Re: Change in behavior to stat(1)

2011-02-28 Thread Stephen Montgomery-Smith
Jeremy Chadwick wrote: Possibly you could use the example from the find(1) man page: find -L /usr/ports/packages -type l -exec rm -- {} + Delete all broken symbolic links in /usr/ports/packages. (Note that the "+" on the end is not a typo, see the man page) Brilliant! Since

Re: Change in behavior to stat(1)

2011-02-28 Thread Jeremy Chadwick
On Mon, Feb 28, 2011 at 11:15:39AM -0600, Stephen Montgomery-Smith wrote: > I had a little script that would remove broken links. I used to do > it like this: > > if ! stat -L $link > /dev/null; then rm $link; fi > > But recently (some time in February according to the CVS records) > stat was ch

Re: Change in behavior to stat(1)

2011-02-28 Thread Ronald Klop
On Mon, 28 Feb 2011 23:39:10 +0100, jhell wrote: On Mon, 28 Feb 2011 12:15, stephen@ wrote: I had a little script that would remove broken links. I used to do it like this: if ! stat -L $link > /dev/null; then rm $link; fi But recently (some time in February according to the CVS records)

Re: Change in behavior to stat(1)

2011-02-28 Thread jhell
On Mon, 28 Feb 2011 12:15, stephen@ wrote: I had a little script that would remove broken links. I used to do it like this: if ! stat -L $link > /dev/null; then rm $link; fi But recently (some time in February according to the CVS records) stat was changed so that stat -L would use lstat(2)

Change in behavior to stat(1)

2011-02-28 Thread Stephen Montgomery-Smith
I had a little script that would remove broken links. I used to do it like this: if ! stat -L $link > /dev/null; then rm $link; fi But recently (some time in February according to the CVS records) stat was changed so that stat -L would use lstat(2) if the link is broken. So I had to change