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

Bug#288616: use of ">" in tetex postinst errors for sites using bash noclobber



On Mon, Jan 10, 2005 at 02:31:54PM +0100, Frank K?ster wrote:
>"George Georgalis" <george@galis.org> wrote:
>
>> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=275140
>>
>> I don't agree with all the points in message dated.
>> Date: Sat, 9 Oct 2004 20:39:17 -0500
>>
>> eg debian doesn't set BASH_ENV by default, and I don't use it, which
>> kinda breaks most of what he's saying, and sidetracked the issue.
>
>Why do you think that? Things usually work exactly because Debian, by
>default, does no mixing up of the different initialisation files:
>Because BASH_ENV is not set by default, and because it does not by
>default source any of the initialisation files from any other, the
>invocation modes are clearly separated.
>
>If on your system scripts starting with "#!/bin/sh" or "#!/bin/bash"
>have noclobber set, I think this must be because you have tweaked the
>initialisation process inappropriately, ending up with
>interactive-specific things set in noninteractive shells.

I don't think what I wrote, abet over condensed, was interpreted
correctly. Simply, his issue was BASH_ENV, I don't use it, but I still
have a login shell for *.postinst.


>> And per the last couple of messages (up to Date: Sat, 9 Oct 2004
>> 23:42:05 -0500); I stand by my last post, apt-get should use
>> non-interactive and/or --norc invocation.
>
>I think it does. Why do you think that apt-get (in fact it is dpkg)
>invoke maintainer scripts in a way that the shell is interactive?
>
>> The setting of noclobber is
>> an option for interactive shells (when put in ~/.bashrc). Programs like
>> apt-get should not inherit user environment and croak on something as
>> benign as the equivalent to "alias rm='rm -i'"
>
>Programs _must_ inherit the user environment they are called with, this
>is a requirement of POSIX. But user environment in this sense only
>covers environment variables marked with "export", not shell options
>like noclobber or shell aliases. Which is to say: apt-get already does
>what you demand of it. I really don't see where the bug is.

Thanks for clearing up the exported environment, shell options, POSIX,
user environment.

I did find an exported BASH_ENV (which I don't normally use) in
~root/.profile I did check before, but somehow I missed it.

There may be something else though, even with export BASH_ENV=$HOME/.bashrc
in $HOME/.profile and "set -o noclobber" in $HOME/.bashrc, I get the
following results:

root@run:~/ # cat testclobber.sh
#/bin/bash
touch ~/testclobber.txt
echo >~/testclobber.txt
root@run:~/ # source testclobber.sh
bash: /root/testclobber.txt: cannot overwrite existing file
root@run:~/ # sh testclobber.sh
root@run:~/ # 

I think it illustrates the system only sets noclobber for login shells.
It would seem the apt-get/dpkg process invokes tetex.postinst as a login
shell, because of the noclobber error creating the temp file -- feel
free to correct me on this and I'll go away.

I'd appreciate >> vs > for writing to mktemp files on the next release.

// George


-- 
George Georgalis, systems architect, administrator Linux BSD IXOYE
http://galis.org/george/ cell:646-331-2027 mailto:george@galis.org



Reply to: