bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#149454: uudecode bug (?)


From: Paul Eggert
Subject: Re: Bug#149454: uudecode bug (?)
Date: Tue, 9 Jul 2002 18:43:24 -0700 (PDT)

> From: martin f krafft <address@hidden>
> Date: Tue, 9 Jul 2002 14:44:25 +0200
> 
> do you mean that POSIX differentiates between overwriting and
> replacing? i'd define the first as inode preserving, the second as
> creating a new inode while dropping the old.

Yes, there is a difference.  For example, if there are two hard links
to the same file, overwriting the file affects both hard links, whereas
what you call "replacing" would remove one hard link and create a new file;
the other hard link would be unaffected.

> i did read the URL you posted, as well as the uudecode.html file, and
> it does mention overwrite rather than replace. given that and the
> posix definition, i am willing to argue that uudecode doesn't contain
> a bug wrt the standard.
> 
> nevertheless, i still don't see the rationale behind this behaviour.
> if you do have a spare minute, would you mind ensuring that i grasp
> just why uudecode must overwrite while tar replaces?

POSIX doesn't require that tar must replace.  It places no
requirements on tar at all.  My impression is that some
implementations of tar replace, while others overwrite; portable shell
scripts cannot assume either behavior.  GNU tar will behave either
way, depending on whether you specify the --overwrite and/or
--unlink-first options.  The default GNU tar behavior is neither
--overwrite nor --unlink-first, but is closer to the latter than to
the former.

uudecode must overwrite because that's the Unix tradition.  Nearly
every Unix command overwrites rather than replaces.  tar and gzip
disagree with this tradition, but they are not traditional Unix
commands and are not standardized by POSIX.

Traditionally, it's the user's responsibility to avoid problems with
overwriting existing files in an untrusted environment.  There are
several ways to do this.  One POSIX-standardized way to do this is to
use the 'set -C' shell command.  This doesn't work with older
(non-POSIX) shells, but a portable way is to make a temporary
directory and then use that.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]