unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
@ 2015-01-30  5:18 crocket
  2015-01-30  9:38 ` crocket
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: crocket @ 2015-01-30  5:18 UTC (permalink / raw)
  To: 19731

According to https://bbs.archlinux.org/viewtopic.php?pid=1397412#p1397412
, if HISTFILE=/dev/null is set as an environment variable, /dev/null
can be deleted and replaced by a regular file with permission 600.

If I fiddled with magit over tramp sudo method for a while and exited
emacs, I see /dev/null replaced with a regular file with permission
600.

After some inspections, I found HISTFILE=/dev/null in tramp-sh.el.

Could tramp-sh.el be the cause of /dev/null problem?

In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.7)
 of 2015-01-18 on bisson
Windowing system distributor `The X.Org Foundation', version 11.0.11603000
Configured using:
 `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Important settings:
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> C-x C-f <backspace> C-g M-x r e p o r t
<tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message idna format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils info easymenu package epg-config
time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind gfilenotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

Memory information:
((conses 16 113852 6530)
 (symbols 48 20679 0)
 (miscs 40 87 124)
 (strings 32 22379 4312)
 (string-bytes 1 542144)
 (vectors 16 12069)
 (vector-slots 8 418986 5747)
 (floats 8 66 65)
 (intervals 56 224 19)
 (buffers 960 12)
 (heap 1024 50731 994))





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-01-30  5:18 bug#19731: 24.4; /dev/null is deleted by tramp-sh.el crocket
@ 2015-01-30  9:38 ` crocket
  2015-01-30  9:41 ` crocket
  2015-02-06 11:01 ` Alad Wenter
  2 siblings, 0 replies; 20+ messages in thread
From: crocket @ 2015-01-30  9:38 UTC (permalink / raw)
  To: 19731

I confirmed that if $HISTFILE is /dev/null on bash and I execute more
commands than $HISTFILESIZE, when I exit bash, /dev/null is deleted.

Thus, if tramp executes more commands than $HISTFILESIZE and I quit
emacs, /dev/null is deleted.

On Fri, Jan 30, 2015 at 2:18 PM, crocket <crockabiscuit@gmail.com> wrote:
> According to https://bbs.archlinux.org/viewtopic.php?pid=1397412#p1397412
> , if HISTFILE=/dev/null is set as an environment variable, /dev/null
> can be deleted and replaced by a regular file with permission 600.
>
> If I fiddled with magit over tramp sudo method for a while and exited
> emacs, I see /dev/null replaced with a regular file with permission
> 600.
>
> After some inspections, I found HISTFILE=/dev/null in tramp-sh.el.
>
> Could tramp-sh.el be the cause of /dev/null problem?
>
> In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.7)
>  of 2015-01-18 on bisson
> Windowing system distributor `The X.Org Foundation', version 11.0.11603000
> Configured using:
>  `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
>  --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
>  'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
>  --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2
>  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
>
> Important settings:
>   value of $LANG: en_US.utf8
>   value of $XMODIFIERS: @im=ibus
>   locale-coding-system: utf-8-unix
>
> Major mode: Fundamental
>
> Minor modes in effect:
>   tooltip-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   blink-cursor-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   buffer-read-only: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> <help-echo> C-x C-f <backspace> C-g M-x r e p o r t
> <tab> <return>
>
> Recent messages:
> For information about GNU Emacs and the GNU system, type C-h C-a.
> Quit
>
> Load-path shadows:
> None found.
>
> Features:
> (shadow sort gnus-util mail-extr emacsbug message idna format-spec
> rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
> mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
> mm-util help-fns mail-prsvr mail-utils info easymenu package epg-config
> time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
> mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
> tabulated-list newcomment lisp-mode prog-mode register page menu-bar
> rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
> facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
> tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
> czech european ethiopic indian cyrillic chinese case-table epa-hook
> jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
> faces cus-face macroexp files text-properties overlay sha1 md5 base64
> format env code-pages mule custom widget hashtable-print-readable
> backquote make-network-process dbusbind gfilenotify dynamic-setting
> system-font-setting font-render-setting move-toolbar gtk x-toolkit x
> multi-tty emacs)
>
> Memory information:
> ((conses 16 113852 6530)
>  (symbols 48 20679 0)
>  (miscs 40 87 124)
>  (strings 32 22379 4312)
>  (string-bytes 1 542144)
>  (vectors 16 12069)
>  (vector-slots 8 418986 5747)
>  (floats 8 66 65)
>  (intervals 56 224 19)
>  (buffers 960 12)
>  (heap 1024 50731 994))
>
>
>





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-01-30  5:18 bug#19731: 24.4; /dev/null is deleted by tramp-sh.el crocket
  2015-01-30  9:38 ` crocket
@ 2015-01-30  9:41 ` crocket
  2015-02-02 11:44   ` Michael Albinus
  2015-02-06 11:01 ` Alad Wenter
  2 siblings, 1 reply; 20+ messages in thread
From: crocket @ 2015-01-30  9:41 UTC (permalink / raw)
  To: 19731

I think there are at least two solutions to tramp-sh.el problem.

1) Change the shell to zsh
2) unset $HISTFILE and set HISTFILESIZE to 0 instead of setting
HISTFILE to /dev/null
3) etc...

On Fri, Jan 30, 2015 at 2:18 PM, crocket <crockabiscuit@gmail.com> wrote:
> According to https://bbs.archlinux.org/viewtopic.php?pid=1397412#p1397412
> , if HISTFILE=/dev/null is set as an environment variable, /dev/null
> can be deleted and replaced by a regular file with permission 600.
>
> If I fiddled with magit over tramp sudo method for a while and exited
> emacs, I see /dev/null replaced with a regular file with permission
> 600.
>
> After some inspections, I found HISTFILE=/dev/null in tramp-sh.el.
>
> Could tramp-sh.el be the cause of /dev/null problem?
>
> In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.7)
>  of 2015-01-18 on bisson
> Windowing system distributor `The X.Org Foundation', version 11.0.11603000
> Configured using:
>  `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
>  --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
>  'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
>  --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2
>  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
>
> Important settings:
>   value of $LANG: en_US.utf8
>   value of $XMODIFIERS: @im=ibus
>   locale-coding-system: utf-8-unix
>
> Major mode: Fundamental
>
> Minor modes in effect:
>   tooltip-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   blink-cursor-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   buffer-read-only: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> <help-echo> C-x C-f <backspace> C-g M-x r e p o r t
> <tab> <return>
>
> Recent messages:
> For information about GNU Emacs and the GNU system, type C-h C-a.
> Quit
>
> Load-path shadows:
> None found.
>
> Features:
> (shadow sort gnus-util mail-extr emacsbug message idna format-spec
> rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
> mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
> mm-util help-fns mail-prsvr mail-utils info easymenu package epg-config
> time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
> mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
> tabulated-list newcomment lisp-mode prog-mode register page menu-bar
> rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
> facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
> tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
> czech european ethiopic indian cyrillic chinese case-table epa-hook
> jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
> faces cus-face macroexp files text-properties overlay sha1 md5 base64
> format env code-pages mule custom widget hashtable-print-readable
> backquote make-network-process dbusbind gfilenotify dynamic-setting
> system-font-setting font-render-setting move-toolbar gtk x-toolkit x
> multi-tty emacs)
>
> Memory information:
> ((conses 16 113852 6530)
>  (symbols 48 20679 0)
>  (miscs 40 87 124)
>  (strings 32 22379 4312)
>  (string-bytes 1 542144)
>  (vectors 16 12069)
>  (vector-slots 8 418986 5747)
>  (floats 8 66 65)
>  (intervals 56 224 19)
>  (buffers 960 12)
>  (heap 1024 50731 994))
>
>
>





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-01-30  9:41 ` crocket
@ 2015-02-02 11:44   ` Michael Albinus
       [not found]     ` <CAL0=0H0i02hc96VRz4HFnS9ztr2-1SxaykZiJ6mqPQxm5h2aag@mail.gmail.com>
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Albinus @ 2015-02-02 11:44 UTC (permalink / raw)
  To: crocket; +Cc: 19731

crocket <crockabiscuit@gmail.com> writes:

Hi,

> I think there are at least two solutions to tramp-sh.el problem.
>
> 1) Change the shell to zsh
> 2) unset $HISTFILE and set HISTFILESIZE to 0 instead of setting
> HISTFILE to /dev/null
> 3) etc...

In Emacs 25 (the development version), there is a customer option
`tramp-histfile-override'. You could use it for setting HISTFILE to
another value but "/dev/null". If you use the symbol `unset' as value,
HISTFILE will be unset.

Do you have a chance to check it?

Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
       [not found]       ` <87mw4wjyqi.fsf@gmx.de>
@ 2015-02-02 12:22         ` crocket
  2015-02-02 12:45           ` Michael Albinus
  0 siblings, 1 reply; 20+ messages in thread
From: crocket @ 2015-02-02 12:22 UTC (permalink / raw)
  To: Michael Albinus, 19731

On bash, if you become root, and set HISTFILE to /dev/null and
HISTFILESIZE to a very small number, and execute more than
$HISTFILESIZE commands, and exit bash, then
you'll see /dev/null replaced with a regular file with permission 600.

If you can't reproduce it, then I'll test tramp on emacs 25 with
'tramp-histfile-override' set to 'unset'.

On Mon, Feb 2, 2015 at 9:15 PM, Michael Albinus <michael.albinus@gmx.de> wrote:
> crocket <crockabiscuit@gmail.com> writes:
>
>> I confirmed that bash deletes /bin/bash with HISTFILE=/dev/null after
>> executing more commands than HISTFILESIZE.
>> Thus, I can already imagine the outcome of unsetting HISTFILE.
>> You can test emacs 25 with various values of HISTFILE on systems that
>> have /bin/sh symlinked to /bin/bash.
>
> Well, I couldn't test whether Tramp behaves correctly because I have no
> test system where bash behaves like described by you. So I hope to get
> feedback, whether Tramp behaves correctly.
>
>> I think 'unset' is a reasonable default value for HISTFILE because
>> people are not interested in tramp history by default.
>
> Well, changing the default would need much more testing with other
> shells but bash. That's why it is offered as option only, and not as default.
>
> Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-02 12:22         ` crocket
@ 2015-02-02 12:45           ` Michael Albinus
  2015-02-02 12:46             ` crocket
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Albinus @ 2015-02-02 12:45 UTC (permalink / raw)
  To: crocket; +Cc: 19731

crocket <crockabiscuit@gmail.com> writes:

> On bash, if you become root, and set HISTFILE to /dev/null and
> HISTFILESIZE to a very small number, and execute more than
> $HISTFILESIZE commands, and exit bash, then
> you'll see /dev/null replaced with a regular file with permission 600.

Tramp doesn't set HISTFILESIZE to any value. Maybe it should set it to a
reasonable large number, when HISTFILE is set to /dev/null?

> If you can't reproduce it, then I'll test tramp on emacs 25 with
> 'tramp-histfile-override' set to 'unset'.

Please do.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-02 12:45           ` Michael Albinus
@ 2015-02-02 12:46             ` crocket
  2015-02-02 13:04               ` Michael Albinus
  0 siblings, 1 reply; 20+ messages in thread
From: crocket @ 2015-02-02 12:46 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 19731

You shouldn't set HISTFILE to /dev/null in the first place.

On Mon, Feb 2, 2015 at 9:45 PM, Michael Albinus <michael.albinus@gmx.de> wrote:
> crocket <crockabiscuit@gmail.com> writes:
>
>> On bash, if you become root, and set HISTFILE to /dev/null and
>> HISTFILESIZE to a very small number, and execute more than
>> $HISTFILESIZE commands, and exit bash, then
>> you'll see /dev/null replaced with a regular file with permission 600.
>
> Tramp doesn't set HISTFILESIZE to any value. Maybe it should set it to a
> reasonable large number, when HISTFILE is set to /dev/null?
>
>> If you can't reproduce it, then I'll test tramp on emacs 25 with
>> 'tramp-histfile-override' set to 'unset'.
>
> Please do.
>
> Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-02 12:46             ` crocket
@ 2015-02-02 13:04               ` Michael Albinus
  2015-02-02 14:18                 ` crocket
  2015-02-02 18:44                 ` Stefan Monnier
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Albinus @ 2015-02-02 13:04 UTC (permalink / raw)
  To: crocket; +Cc: 19731

crocket <crockabiscuit@gmail.com> writes:

> You shouldn't set HISTFILE to /dev/null in the first place.

Well, I'm kind of conservative. Setting HISTFILE to /dev/null is the
default for years, and your report is the first one about this problem.

I wouldn't say that we shouldn't change it, but it needs more
compatibility tests for supported shells. This could be any bournish
shell, even very old ones. Also all flavors of busybox, etc pp.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-02 13:04               ` Michael Albinus
@ 2015-02-02 14:18                 ` crocket
  2015-02-02 15:25                   ` Michael Albinus
  2015-02-02 18:44                 ` Stefan Monnier
  1 sibling, 1 reply; 20+ messages in thread
From: crocket @ 2015-02-02 14:18 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 19731

Bash guys hate to see HISTFILE set to /dev/null, and they say it is
stupid to do so.
In their mind, setting HISTFILE to /dev/null or any other character
device leads to vulnerabilities for now.
However, they are willing to deal with the HISTFILE issue because bash
shouldn't delete /dev/null in any case.

If bash guys consider it as a vulnerability, I think it is wise for
emacs guys to avoid it on their side.

On Mon, Feb 2, 2015 at 10:04 PM, Michael Albinus <michael.albinus@gmx.de> wrote:
> crocket <crockabiscuit@gmail.com> writes:
>
>> You shouldn't set HISTFILE to /dev/null in the first place.
>
> Well, I'm kind of conservative. Setting HISTFILE to /dev/null is the
> default for years, and your report is the first one about this problem.
>
> I wouldn't say that we shouldn't change it, but it needs more
> compatibility tests for supported shells. This could be any bournish
> shell, even very old ones. Also all flavors of busybox, etc pp.
>
> Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-02 14:18                 ` crocket
@ 2015-02-02 15:25                   ` Michael Albinus
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Albinus @ 2015-02-02 15:25 UTC (permalink / raw)
  To: crocket; +Cc: 19731

crocket <crockabiscuit@gmail.com> writes:

> If bash guys consider it as a vulnerability, I think it is wise for
> emacs guys to avoid it on their side.

Hmmm. Emacs 25 is still in development, so it might not be too
harmful. I'll set `unset' as default; let's wait for complaints ...

Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-02 13:04               ` Michael Albinus
  2015-02-02 14:18                 ` crocket
@ 2015-02-02 18:44                 ` Stefan Monnier
  2015-02-02 19:50                   ` Michael Albinus
  1 sibling, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2015-02-02 18:44 UTC (permalink / raw)
  To: Michael Albinus; +Cc: crocket, 19731

> Well, I'm kind of conservative. Setting HISTFILE to /dev/null is the
> default for years, and your report is the first one about this problem.

It seems like a plain bug for bash to do what it does (does it also
turn a symlink into a plain file?  wouldn't that also be a bug?), but
I wonder: what could Tramp do instead of setting HISTFILE to /dev/null?
Could unsetting it result in the same behavior (i.e. not save Tramp's
commands to any file)?


        Stefan





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-02 18:44                 ` Stefan Monnier
@ 2015-02-02 19:50                   ` Michael Albinus
  2015-02-02 20:08                     ` Glenn Morris
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Albinus @ 2015-02-02 19:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: crocket, 19731

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Well, I'm kind of conservative. Setting HISTFILE to /dev/null is the
>> default for years, and your report is the first one about this problem.
>
> It seems like a plain bug for bash to do what it does

Looks to me like this.

> (does it also
> turn a symlink into a plain file?  wouldn't that also be a bug?), but
> I wonder: what could Tramp do instead of setting HISTFILE to /dev/null?
> Could unsetting it result in the same behavior (i.e. not save Tramp's
> commands to any file)?

That's how I understood the doc. Hope somebody will test it.

>         Stefan

Best regards, Michael.

PS: I've changed the corresponding value of `tramp-histfile-override' to
t instead of `unset'. It looks more natural to Lisp.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-02 19:50                   ` Michael Albinus
@ 2015-02-02 20:08                     ` Glenn Morris
  2015-02-03  3:06                       ` crocket
  0 siblings, 1 reply; 20+ messages in thread
From: Glenn Morris @ 2015-02-02 20:08 UTC (permalink / raw)
  To: Michael Albinus; +Cc: crocket, 19731

Michael Albinus wrote:

>> It seems like a plain bug for bash to do what it does
>
> Looks to me like this.

I don't think the bash folks disagree, but as always the question is
what to do about it:

http://lists.gnu.org/archive/html/bug-bash/2015-01/msg00138.html

>> I wonder: what could Tramp do instead of setting HISTFILE to /dev/null?
>> Could unsetting it result in the same behavior (i.e. not save Tramp's
>> commands to any file)?
>
> That's how I understood the doc. Hope somebody will test it.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/fc.html

says that

   If the HISTFILE variable is not set, the shell may attempt to access
   or create a file .sh_history in the directory referred to by the HOME
   environment variable.

and indeed by experiment with bash 4.2.45, that is exactly what happes
with HISTFILE unset and using "bash --posix".

So (probably) you can't win.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-02 20:08                     ` Glenn Morris
@ 2015-02-03  3:06                       ` crocket
  2015-02-03  8:34                         ` Michael Albinus
  0 siblings, 1 reply; 20+ messages in thread
From: crocket @ 2015-02-03  3:06 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Michael Albinus, 19731

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

Unsetting HISTFILE and setting HISTFILESIZE to 0 disables history logging
altogether on bash.
On Feb 3, 2015 5:08 AM, "Glenn Morris" <rgm@gnu.org> wrote:

> Michael Albinus wrote:
>
> >> It seems like a plain bug for bash to do what it does
> >
> > Looks to me like this.
>
> I don't think the bash folks disagree, but as always the question is
> what to do about it:
>
> http://lists.gnu.org/archive/html/bug-bash/2015-01/msg00138.html
>
> >> I wonder: what could Tramp do instead of setting HISTFILE to /dev/null?
> >> Could unsetting it result in the same behavior (i.e. not save Tramp's
> >> commands to any file)?
> >
> > That's how I understood the doc. Hope somebody will test it.
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/fc.html
>
> says that
>
>    If the HISTFILE variable is not set, the shell may attempt to access
>    or create a file .sh_history in the directory referred to by the HOME
>    environment variable.
>
> and indeed by experiment with bash 4.2.45, that is exactly what happes
> with HISTFILE unset and using "bash --posix".
>
> So (probably) you can't win.
>

[-- Attachment #2: Type: text/html, Size: 1697 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-03  3:06                       ` crocket
@ 2015-02-03  8:34                         ` Michael Albinus
  2015-02-03  9:10                           ` Andreas Schwab
  2015-02-03 16:54                           ` Glenn Morris
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Albinus @ 2015-02-03  8:34 UTC (permalink / raw)
  To: crocket; +Cc: 19731

crocket <crockabiscuit@gmail.com> writes:

> Unsetting HISTFILE and setting HISTFILESIZE to 0 disables history
> logging altogether on bash.

HISTFILESIZE is bashism. Other shells use HISTSIZE.

> On Feb 3, 2015 5:08 AM, "Glenn Morris" <rgm@gnu.org> wrote:
>     
>     http://pubs.opengroup.org/onlinepubs/9699919799/utilities/fc.html
>     
>     says that
>     
>     If the HISTFILE variable is not set, the shell may attempt to
>     access
>     or create a file .sh_history in the directory referred to by the
>     HOME
>     environment variable.
>     
>     and indeed by experiment with bash 4.2.45, that is exactly what
>     happes
>     with HISTFILE unset and using "bash --posix".
>     
>     So (probably) you can't win.

Now, when I unset HISTFILE in Tramp, I also set HISTFILESIZE and
HISTSIZE to 0. And hope it works with most shells. Praying won't help.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-03  8:34                         ` Michael Albinus
@ 2015-02-03  9:10                           ` Andreas Schwab
  2015-02-03  9:23                             ` Michael Albinus
  2015-02-03 16:54                           ` Glenn Morris
  1 sibling, 1 reply; 20+ messages in thread
From: Andreas Schwab @ 2015-02-03  9:10 UTC (permalink / raw)
  To: Michael Albinus; +Cc: crocket, 19731

Michael Albinus <michael.albinus@gmx.de> writes:

> HISTFILESIZE is bashism. Other shells use HISTSIZE.

bash uses both.

    HISTFILESIZE        The maximum number of lines this file can contain.
    HISTSIZE    The maximum number of history lines that a running
                shell can access.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-03  9:10                           ` Andreas Schwab
@ 2015-02-03  9:23                             ` Michael Albinus
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Albinus @ 2015-02-03  9:23 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: crocket, 19731

Andreas Schwab <schwab@suse.de> writes:

>     HISTFILESIZE        The maximum number of lines this file can contain.
>     HISTSIZE    The maximum number of history lines that a running
>                 shell can access.

Yes. But for the history file, only HISTFILESIZE seems to be
relevant. That's what counts for Tramp.

> Andreas.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-03  8:34                         ` Michael Albinus
  2015-02-03  9:10                           ` Andreas Schwab
@ 2015-02-03 16:54                           ` Glenn Morris
  1 sibling, 0 replies; 20+ messages in thread
From: Glenn Morris @ 2015-02-03 16:54 UTC (permalink / raw)
  To: Michael Albinus; +Cc: crocket, 19731

Michael Albinus wrote:

> Now, when I unset HISTFILE in Tramp, I also set HISTFILESIZE and
> HISTSIZE to 0. 

I'd be concerned that that might mean "use the default history file, and
truncate it to zero size [even if it already existed]" to some shell,
but I haven't actually checked.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-01-30  5:18 bug#19731: 24.4; /dev/null is deleted by tramp-sh.el crocket
  2015-01-30  9:38 ` crocket
  2015-01-30  9:41 ` crocket
@ 2015-02-06 11:01 ` Alad Wenter
  2015-02-08 10:05   ` Michael Albinus
  2 siblings, 1 reply; 20+ messages in thread
From: Alad Wenter @ 2015-02-06 11:01 UTC (permalink / raw)
  To: 19731

Could you provide some more detail on unsetting $HISTFILE? Symlinking 
/bin/sh to zsh seems a bit drastic..

Alad





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#19731: 24.4; /dev/null is deleted by tramp-sh.el
  2015-02-06 11:01 ` Alad Wenter
@ 2015-02-08 10:05   ` Michael Albinus
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Albinus @ 2015-02-08 10:05 UTC (permalink / raw)
  To: Alad Wenter; +Cc: 19731

Alad Wenter <alad@archlinux.info> writes:

> Could you provide some more detail on unsetting $HISTFILE? Symlinking
> /bin/sh to zsh seems a bit drastic..

Tramp does it meanwhile in Emacs 25.0.50 (not symlinking sh to zsh :-)
When it opens a connection, it calls

exec env ENV='' HISTFILE='' HISTFILESIZE=0 HISTSIZE=0 PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh 

This seems to be sufficient.

> Alad

Best regards, Michael.





^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2015-02-08 10:05 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-30  5:18 bug#19731: 24.4; /dev/null is deleted by tramp-sh.el crocket
2015-01-30  9:38 ` crocket
2015-01-30  9:41 ` crocket
2015-02-02 11:44   ` Michael Albinus
     [not found]     ` <CAL0=0H0i02hc96VRz4HFnS9ztr2-1SxaykZiJ6mqPQxm5h2aag@mail.gmail.com>
     [not found]       ` <87mw4wjyqi.fsf@gmx.de>
2015-02-02 12:22         ` crocket
2015-02-02 12:45           ` Michael Albinus
2015-02-02 12:46             ` crocket
2015-02-02 13:04               ` Michael Albinus
2015-02-02 14:18                 ` crocket
2015-02-02 15:25                   ` Michael Albinus
2015-02-02 18:44                 ` Stefan Monnier
2015-02-02 19:50                   ` Michael Albinus
2015-02-02 20:08                     ` Glenn Morris
2015-02-03  3:06                       ` crocket
2015-02-03  8:34                         ` Michael Albinus
2015-02-03  9:10                           ` Andreas Schwab
2015-02-03  9:23                             ` Michael Albinus
2015-02-03 16:54                           ` Glenn Morris
2015-02-06 11:01 ` Alad Wenter
2015-02-08 10:05   ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).