"Paul Eggert" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Instead of adding a new option, I think I'd rather change 'sort' to
> cater to your (relatively common) case, rather than to the (relatively
> contrived) cases like `cat F | sort -m -o F - G' where people should
> know that they're getting into trouble anyway.

I completely agree that this example is quite contrived, and your patch is
welcome.
Yet there is a simple way to fix sort's behaviour to cater to this case
without resorting (no pun intended) to a temporary file.  sort should first
try to unlink the output file before opening it in "w" mode.
cat would keep reading the old file while sort writes to a new file with the
same name.
reasons why this would fail are :
- bogus file system (windows) -> current behaviour
- output file is a symlink -> the user will get in trouble with this sooner
or later -> check for this and do not unlink that.
- inode number for output file will change. is this a problem ?

Is there a major reason I'm missing that makes this kind of change
undesirable ?

Chqrle.







_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to