
[ Home | Liste | F.A.Q. |
Risorse | Cerca... ]
Archivio: Luglio 2004 ml@sikurezza.org Soggetto: Re: [ml] bash_history vuoto Mittente: Emiliano 'AlberT' Gabrielli Data: Tue, 13 Jul 2004 11:28:55 +0200 (CEST)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 10:12, martedì 13 luglio 2004, Claudio wrote:
> "On startup, the history is initialized from the file named by the vari-
> able HISTFILE (default ~/.bash_history). The file named by the value
> of HISTFILE is truncated, if necessary, to contain no more than the
> number of lines specified by the value of HISTFILESIZE. When an inter-
> active shell exits, the last $HISTSIZE lines are copied from the his-
> tory list to $HISTFILE. If the histappend shell option is enabled (see
> the description of shopt under SHELL BUILTIN COMMANDS below), the lines
> are appended to the history file, otherwise the history file is over-
> written."
>
> Ergo, pare che "the histappend shell option" decida la sorte del file in
> questione...
riguardo il mio precedente post, ho riletto il 3d, e la mia risposta
precedente non ha senso... a meno di mera curiosità riguardo la necessità di
ritoccare oltre ad HISTFILESIZE _anche_ HISTSIZE.
La questione che invece mi pongo, riguardo la interpretazione del problema
all'incipit del 3d, è:
- - bash_history : vuoto
- - sono stato bucato ?
- - tranquillo è normale, hai raggiunto HISTFILESIZE e bash stessa ti ha
riazzerato il file.
Secondo me questa interpretazione è fallace, in quanto _se_ apro una shell e
poi la chiudo si presentano 2 casi:
- - eseguo almeno 1 comando
- - faccio CTRL-D senza aver digitato alcun comando (esco subito)
poichè la man page recita
> The file named by the value
> of HISTFILE is truncated, if necessary, to contain no more than the
> number of lines specified by the value of HISTFILESIZE. When an inter-
> active shell exits, the last $HISTSIZE lines are copied from the his-
> tory list to $HISTFILE.
si deduce che il file aumenterebbe di almeno 1 riga nel primo caso e
rimarrebbe invariato nel secondo. Quindi l'analisi del reale contenuto del
file nel secondo caso si riduce a quello del primo caso, in relazione però
alla sessione shell precedente.
Ora, dovendo scrivere almeno 1 riga è evidente che se la dimensione del file
fosse stata HISTFILESIZE -1 nessun troncamento avverrebbe.
E' altrettanto chiaro che se le righe fossero di +, diciamo 2, allora quello
che accadrebbe sarebbe:
- - il primo comando viene scritto in append
- - è dunque ora raggiunto il limite di HISTFILESIZE
- - truncate
- - salva il secondo comando
Tanta prolissitudo per argomentare che, IMHO, l' HISTFILE non dovrebbe mai
essere vuoto a causa di un normale comportamento della shell...
quindi ritengo che l'autore di questo 3d debba approfondire meglio la
questione.
Poichè il man recita anche:
" ... After saving the history, the history file is truncated to contain no
more than HISTFILESIZE lines. "
ritengo che l'unico modo per ottenere un .bash_history vuoto sia (oltre
svuotarlo a mano, ovviamnete) impostare HISTFILESIZE a 0... che mi farebbe
pensare ad un tentativo maldestro di hacking.
- --
<?php echo ' Emiliano `AlberT` Gabrielli '."\n".
' E-Mail: AlberT_AT_SuperAlberT_it '."\n".
' Web: http://SuperAlberT.it '."\n".
' IRC: #php,#AES azzurra.com '."\n".'ICQ: 158591185'; ?>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFA86tdF4boRkzPHocRAlmeAJ9w0ktC14cIqD8wt4ojmgFRZ5gFZACcCp/J
uT+hzyjJtBfSvkgrdwhKsjA=
=QhQa
-----END PGP SIGNATURE-----
[ Home | Liste | F.A.Q. |
Risorse | Cerca... ]
www.sikurezza.org - Italian Security Mailing List
(c) 1999-2005