1

My emacs dired changes sort order from ASCII to case-insensitive whenever I view a directory listing under sudo::. Checking getenv on LC_COLLATE shows that emacs still thinks the value is 'C'; and ls -la under sudo on the command line still returns files sorted in ASCII order; so I have a hard time blaming sudo itself.

emacs 24.5.1

Ubuntu 4.8.4-2ubuntu1~14.04.3

Edit per jue 2017.06.16:

dired without sudo: ASCII sort without sudo

dired with sudo: unknown sort with sudo

@jue: I believe you are correct that the sudo dired no longer considers LC_COLLATE; but I have no idea what else might be causing this.

Please note that outside emacs on the command line sudo and ls do not change sort order.

long listing without sudo:

$ l /usr/local/rancid3/
total 208
drwxrwx---  9 rancid3 netadm  4096 Jun 16 09:25 .
drwxr-xr-x 16 root    root    4096 Apr  4 12:55 ..
-rw-------  1 rancid3 netadm  1510 Jun 14 13:17 .bash_history
-rw-r-----  1 rancid3 netadm  4634 Apr  5 06:32 .cloginrc
-rw-r-----  1 root    root   19737 Nov 18  2016 .cloginrc.JK
-rw-r--r--  1 root    root    3772 Sep  4  2016 .cloginrc.sample
drwx------  2 rancid3 netadm  4096 Nov 18  2016 .emacs.d
-rw-r--r--  1 rancid3 netadm    77 Nov 18  2016 .selected_editor
drwx------  3 rancid3 netadm  4096 Nov 19  2016 .ssh
-rw-r--r--  1 root    root   62285 Sep  4  2016 CHANGES
-rw-r--r--  1 root    root    2797 Sep  4  2016 COPYING
-rw-r--r--  1 root    root   28334 Sep  4  2016 FAQ
-rw-r--r--  1 root    root   16218 Sep  4  2016 README
-rw-r--r--  1 root    root    4096 Sep  4  2016 README.lg
-rw-r--r--  1 root    root    5519 Jun 14 09:15 README_WHOI.org
-rw-r--r--  1 root    root    5704 Sep  4  2016 UPGRADING
drwxr-xr-x  2 root    root    4096 Mar 29 10:47 bin
drwxr-xr-x  2 root    root    4096 Mar 29 10:47 etc
drwxr-xr-x  3 root    root    4096 Nov 18  2016 lib
drwxr-xr-x  4 root    root    4096 Nov 18  2016 share
drwxr-xr-x  6 rancid3 netadm  4096 Nov 18  2016 var

With sudo:

$ sudo ls -la /usr/local/rancid3/
[sudo] password for ericx: 
total 208
drwxrwx---  9 rancid3 netadm  4096 Jun 16 09:25 .
drwxr-xr-x 16 root    root    4096 Apr  4 12:55 ..
-rw-------  1 rancid3 netadm  1510 Jun 14 13:17 .bash_history
-rw-r-----  1 rancid3 netadm  4634 Apr  5 06:32 .cloginrc
-rw-r-----  1 root    root   19737 Nov 18  2016 .cloginrc.JK
-rw-r--r--  1 root    root    3772 Sep  4  2016 .cloginrc.sample
drwx------  2 rancid3 netadm  4096 Nov 18  2016 .emacs.d
-rw-r--r--  1 rancid3 netadm    77 Nov 18  2016 .selected_editor
drwx------  3 rancid3 netadm  4096 Nov 19  2016 .ssh
-rw-r--r--  1 root    root   62285 Sep  4  2016 CHANGES
-rw-r--r--  1 root    root    2797 Sep  4  2016 COPYING
-rw-r--r--  1 root    root   28334 Sep  4  2016 FAQ
-rw-r--r--  1 root    root   16218 Sep  4  2016 README
-rw-r--r--  1 root    root    4096 Sep  4  2016 README.lg
-rw-r--r--  1 root    root    5519 Jun 14 09:15 README_WHOI.org
-rw-r--r--  1 root    root    5704 Sep  4  2016 UPGRADING
drwxr-xr-x  2 root    root    4096 Mar 29 10:47 bin
drwxr-xr-x  2 root    root    4096 Mar 29 10:47 etc
drwxr-xr-x  3 root    root    4096 Nov 18  2016 lib
drwxr-xr-x  4 root    root    4096 Nov 18  2016 share
drwxr-xr-x  6 rancid3 netadm  4096 Nov 18  2016 var
  • I can reproduce that sorting is not influenced by LC_COLLATE in sudo-dired, but it is influenced on non-sudo-dired. Maybe you give some example with expected and received results, for others to reproduce. I have the same emacs version but are on Debian. – jue Jun 15 '17 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.