[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] --auto-compress command line option
From: |
Helmut Waitzmann |
Subject: |
Re: [Bug-tar] --auto-compress command line option |
Date: |
Sun, 10 Feb 2008 02:27:53 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Denis Excoffier <address@hidden> writes:
>I'm not sure i understand all the implications of what Helmut has
>written. I can add:
>- of course the configure options would not be mandatory, and if not
> set, the behaviour is like now
If the system administrator has configured tar to use a fixed location of
the compressing programs rather than to search using the PATH environment
variable, then there is nothing, a user could do against that, except:
>- at individual level, to use a compress program of your own, you always
> can take benefit of the --use-compress-program command line option
thus the options '-z', '-Z', '-j' won't work anymore for that user.
>- at site level, the selection of which versions of the
> compress/gzip/bzip2/lzma programs to be used is done by the same
> people as those that select (and configure, build, install) the
> version of tar
Yes, it's the administrator's choice. But the users should be given the
chance to override it.
>- with the --auto-compress option, you don't know in advance which
> compress program will be used, therefore in my opinion you cannot use
> --use-compress-program in this case
I don't know the '--auto-compress' option (it's not listed yet in
"http://www.gnu.org/software/tar/manual/html_node/tar_42.html#SEC42"),
but probably it's the same problem as with '-z', '-Z' or '-j'.
>- yes perhaps my proposal would also need the addition of a bypass
> option, in order to the PATH to be used instead of the full path
> selected at configure time
Yes. But than I would rather like to see an option which tells tar to
use the full path selected at configure time, thereby let tar by default
do a PATH search: This would keep tar backward compatible with existing
versions of tar. Someone, who'd like to use the new behavior, could put
that option into the TAR_OPTIONS environment variable.
>- i only wish to get the same mechanism as with the tar program
> itself. You can say:
> (PATH=/site/local/bin; tar etc.)
> but you can also say
> (/site/local/bin/tar etc.)
> that is: not relying on the PATH if you don't want to
> If you need to enforce a specific set of compress programs, you have to
> wrap tar
> into a subshell like the one Helmut proposes, this is too heavy in my
> opinion, or...
... make sure, that the location of that specific set of compress
programs is the first component of the PATH environment variable.
> please Helmut show us your login shell!!!
When you (interactively) log in to your account, then your shell will be
invoked as a login shell by default (so it's quite normal to have a login
shell).
A login shell first reads commands from several startup files before it
executes the given shell script or command line (supplied as a parameter
to the option "-c") or prompts for commands to be executed. (For details
of what a login shell does, see the manual page of the shell.)
For example, a POSIX shell, when invoked as a login shell, first reads
commands from the files "/etc/profile" and "$HOME"/.profile, if they
exist, prior to do anything else.
Thus a system administrator can (and really should) set the PATH
environment variable by writing an appropriate command in the file
"/etc/profile".
Then users may change that variable in their "$HOME"/.profile files, if
they want to, thereby being able to "configure" their own versions of
"gzip", "compress", ... programs.
A common pitfall is to use "su" without its option "-" when changing to
a different user, because "su" invokes the new user's startup shell as a
non-login shell unless given the option "-".
As a non-login startup shell is almost never a good idea (not just
because of the missing initialization of the PATH environment variable,
but also for further parts of a process's environment, e.g. the umask),
specifying the compress programs for tar at configure time wouldn't help
much anyway.
To make a long story short:
If you want GNU tar to always use some special compress programs, you may
put them in a directory of their own and then name the path of that
directory as the first component of the PATH environment variable:
If you want to do that as the system administrator, change the "export
PATH=..." command in the file "/etc/profile", for example:
export PATH=/site/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
If you want to do that as an ordinary user, you may put the command
export \
PATH=/site/local/bin:"${PATH:-/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin}"
into the file "$HOME"/.profile.
Kind regards,
Helmut
--
Wer mir E-Mail schreiben will, stelle | When writing me e-mail, please
bitte vor meine E-Mail-Adresse meinen | precede my e-mail address with
Vor- und Nachnamen, etwa so: | my full name, like
Helmut Waitzmann <address@hidden>, (Helmut Waitzmann) address@hidden