If a file an exact multiple of the max buffer size were sponged, it
would fail at the end due to trying to write 0 remaining bytes from the
buffer to the temp file. A similar bug occurred if sponge's input was
empty. Amazing how such a seemingly simple thing can get so tricky..
Also added check for read error from the temp file, just in case.
*Fixed many bugs relating to renaming of temp file to output file
*Doesn't set umask, not sure what correct behavior is
*Does not try and delete /tmp/sponge.XXXXXX on exit if there was no temporary file used
*Uses temporary file when buffer * 2 is >= mem_available as the buffer will double shortly after this operation
*Only traps signals if we are creating a temporary file
*Cleaned up error messages
Javier Merino [Thu, 20 Mar 2008 12:03:26 +0000 (13:03 +0100)]
Moreutils: Added ifne
Hi, I read the suggestion about ifne in the Discussion page of
moreutils and found it interesting. It's a command that runs another
process if the standard input is not empty. I think it can be very
useful in admin scripts so I've implemented it. I attach a patch
against the current head of moreutils' git. You may include it in
moreutils if you think it's worth it.
I've considered making an "ifempty" or "ifne -v" that would run a
command if the standard input is empty, but I'm not sure if that could
be useful. Any comments will be appreciated. Regards,
Joey Hess [Sat, 2 Feb 2008 22:18:59 +0000 (17:18 -0500)]
* vidir: Applied patch from Stefan Fritsch (one part of #412176):
- Check for control characters (especially newlines) in filenames
and error out, since this can greatly confuse the editor or vidir.
- If the source of a rename does not exist (and thus the rename will fail
anyway), vidir should not move an existing target file to a tmpfile.
- If a directory is renamed, vidir should take that into account when
renaming files in this directory.
- If a directory name is passed as name/ to vidir, vidir should not
add second slash after the name.
* vidir: Add support for unlinking directories. To recursivly delete
a directory and its contents, pipe find to vidir, and delete the directory
and its contents in the editor. Closes: #412176
* Don't strip binaries for debian package if built with
DEB_BUILD_OPTIONS=nostrip. Closes: #437577
* Include Michael Tokarev's lckdo program and replace / conflict with the
current lckdo package. (Robert Edmonds) Closes: #432906
* lckdo: Don't clear other flags when setting close on exec.
joeyh [Fri, 18 Aug 2006 05:46:19 +0000 (05:46 +0000)]
* Change the default ts format to include the month and day, for consistency
with syslog format.
* Add -r switch to ts, which makes it convert existing timestamps in
the input into relative times, such as "15m2s ago".
* vidir, vipe: Use /usr/bin/editor if it's present, and EDITOR and VISUAL
arn't set, to comply with Debian policy. For portability, fall back to vi
if there's no /usr/bin/editor. Closes: #378623
* combine: Man page improvements, to clarify even more that order does
matter and that the operations are not commutative. Closes: #361123
* combine: The behavior of "or" was fairly strange if lines were repeated in
a file. Changed behavior to just print all lines from both files, even
if this means printing dups. Not sure I like this behavior either, but
it's consistent with the very useful behaviors of "and" and "not".
* vidir: Don't abort if it sees an empty or all-whitespace line.
* vidir: If just a filename is removed and the number is left,
treat this the same as removing the whole line, and delete the file,
instead of trying to rename the file to "".
* vidir: Remove the periods after the item numbers.
* vidir: Man page improvements. Closes: #378122
* ifdata: patch from Adam Lackorzynski to translate French error messages
to English and to convert some #defines to enums.
* ifdata: patch from Adam Lackorzynski to avoid printing info for
bogus interface. Closes: #360433
* Add zrun, contributed by Chung-chieh Shan (you might prefer to alias it to
"z").
joeyh [Mon, 27 Mar 2006 18:45:08 +0000 (18:45 +0000)]
* Typo fixes. Closes: #359039, #359040
* pee: don't send a copy of every line sent to every command to stdout.
Seems best for it not to output anything to stdout on its on at all. Closes: #359041
joeyh [Wed, 8 Mar 2006 02:59:27 +0000 (02:59 +0000)]
* Added ifinfo, by Benjamin BAYART (originally called ifcfg).
* Made ifinfo -Wall clean.
* Made ifinfo support -h and print usage on unknown options.
* Cleaned up ifinfo's behavior when asked to print info for nonexistant
devices. Still needs improvement.