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

Re: Bug in cron postinst

Andreas Metzler <ametzler@downhill.at.eu.org> writes:

> Goswin von Brederlow <brederlo@informatik.uni-tuebingen.de> wrote:
> > Steve Greenland <steveg@moregruel.net> writes:
> >> YES, I know that the postinst doesn't work if you don't have any user
> >> crontabs, feel free to stop reporting the bug -- I have enough.
> >> You can get the installation to complete by editing /var/lib/dpkg/info/cron.postinst and removing these three lines near the end:
> >>     for ct in * ; do
> >>         chown $ct:crontab $ct
> >>     done
> > This also won't work with too many users.
> No, it will.
> ametzler@downhill:/tmp/big> rm *
> bash: /bin/rm: Argument list too long
> ametzler@downhill:/tmp/big> for ct in *; do rm $ct ; done \
>   && echo success
> success

for doesn't fork so the realy small commandline limit isn't a
problem. But are you sure the shell does not read in a full list for
"*" and then work through that? Ok, with more users than you can hold
in ram you have other problems.

> > And lets add a user with homedir "`rm -rf ..`" just for fun.
> Would not hurt.

Homedir "a:b"? ==> chown a:b:crontab a:b

> ametzler@downhill:/tmp/big> bar="\`yes\`"
> echo $bar
> `yes`

I'm allways a bit overcarefull with for loops, globing and splitting.
Depending on the shell you get different behaviours. In this simple
case it seems to work out right but take the following as an example:

(my normal shell is zsh)
mrvn@dual:/tmp/bar% touch "a b"
mrvn@dual:/tmp/bar% L=`find`                     
mrvn@dual:/tmp/bar% for i in $L; do echo $i; done
./a b
mrvn@dual:/tmp/bar% bash
bash-2.05b$ L=`find`              
bash-2.05b$ for i in $L; do echo $i; done
bash-2.05b$ exit

> (If you want to see the kernels oom killer in action try "eval $bar",
> I just did. - "Sep  3 10:13:16 downhill kernel: Out of Memory: Killed
> process 788 (bash) ;-)."
>                 cu andreas

:(){:&:}:   (zsh)
X(){X&X}X   (bash)


Reply to: