[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: |
Chet Ramey |
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 14:25:35 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 1/30/15 2:09 PM, Jonathan Hankins wrote:
> A test with the POSIX S_ISREG macro on HISTFILE will determine if it, or
> the file it points to in the case of a symlink, is a regular file.
>
> Just looked through the source, and it looks like general.c:file_exists()
> does not do any special handling of non-regular files, and
> lib/readline/histfile.c:history_do_write() calls open() and rename() on
> HISTFILE without checking if it is a non-regular file, which I imagine
> could lead to various "bad things" in the case of pipes, char and block
> devices, etc. such as what the OP pointed about about "/dev/null".
Well, like always, it depends. The current implementation allows a user
to use a named pipe with a different program running to be a `history
file'. That flexibility can be valuable.
I don't think that readline should be attempting to do backups of non-
regular files, though. The history file truncation code, which is called
when HISTFILESIZE is changed, already rejects attempts to use non-regular
files.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., crocket, 2015/01/30
- If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., crocket, 2015/01/30
- Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., Chet Ramey, 2015/01/30
- Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., Greg Wooledge, 2015/01/30
- Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., Jonathan Hankins, 2015/01/30
- Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted.,
Chet Ramey <=
- Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., Jonathan Hankins, 2015/01/30
- Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., Andreas Schwab, 2015/01/30
- Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., Jonathan Hankins, 2015/01/30
- Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., Chet Ramey, 2015/01/31
- Re: If $HISTFILE is set to /dev/null and you execute more commands than $HISTFILESIZE, /dev/null is deleted., Chet Ramey, 2015/01/31