bug-bash
[Top][All Lists]
Advanced

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

Re: If $HISTFILE is set to /dev/null and you execute more commands than


From: Jonathan Hankins
Subject: Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted.
Date: Fri, 30 Jan 2015 15:39:00 -0600

Doh - slow brain day - thanks for the correction.  That nullifies my concern when user is not root, for part of the rename() issue.

I think the return values of rename() should be checked, and it history_do_write() should not try to rename(bakname, output) unless it actually did rename(output, bakname) successfully.  And with both rename() calls, ERRNO should be reported to the user if they fail.

As far as open() on HISTFILE for append or truncate, when user is root (or when user has owner or group write to the file), I think bash (readline?) shouldn't overwrite, append to or rename non-regular files.

I also think the handling of the case where HISTFILE is a symlink may misbehave (it would read the history in from the file the link refers to, but on overwrite, replace the symlink, instead of the file it refers to.)

-Jonathan Hankins

On Fri, Jan 30, 2015 at 3:27 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
Jonathan Hankins <jhankins@homewood.k12.al.us> writes:

> Aside from the case where the user running bash is root, I think it's not
> uncommon for users to have group write access to a variety of things in
> /dev.

Rename or delete requires write access to the containing directory.

Andreas.

--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




--
------------------------------------------------------------------------
Jonathan Hankins    Homewood City Schools

The simplest thought, like the concept of the number one,
has an elaborate logical underpinning. - Carl Sagan

jhankins@homewood.k12.al.us
------------------------------------------------------------------------


reply via email to

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