unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
@ 2014-11-26 12:03 Rasmus
  2014-11-26 13:35 ` Michael Albinus
  0 siblings, 1 reply; 14+ messages in thread
From: Rasmus @ 2014-11-26 12:03 UTC (permalink / raw)
  To: 19192

Hi,

I want to use TRAMP for editing files over ftp.

I my init.el I have augmented `dired-listing-switches' with
"--group-directories-first" to get a more pleasing listing in dired.
However, this extra flag is added to whatever tramp calls to connect to
ftp.  So in the ftp buffer I see something like this:

ftp> ls -al --group-directories-first /tmp/ange-ftp19481AaR
     usage: ls remote-directory local-file

When I wrap find-file in a `let' with dired-listing-switches set to
"-al" everything works as expected.

I don't know if this is a feature or a bug.

Michael: do you want me to write a patch or will this be a quick fix for
you?

Thanks,
Rasmus

In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
 of 2014-11-25 on W530
Repository revision: 27f46ae31cd289dbff4c521fcf37a1d048693f6e
Windowing system distributor `The X.Org Foundation', version 11.0.11602000
System Description:	Arch Linux

Configured using:
 `configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
 --libexecdir=/usr/lib --mandir=/usr/share/man --without-sound
 --with-xft --with-x-toolkit=gtk3 'CFLAGS=-march=x86-64 -mtune=generic
 -O2 -pipe -fstack-protector --param=ssp-buffer-size=4'
 'LDFLAGS=-lMagickWand-6.Q16HDRI -lMagickCore-6.Q16HDRI '
 CPPFLAGS=-D_FORTIFY_SOURCE=2'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK GPM DBUS GCONF GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB

Important settings:
  value of $LANG: es_ES.utf8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  recentf-mode: t
  diff-auto-refine-mode: t
  nyan-mode: t
  paredit-mode: t
  flyspell-mode: t
  subword-mode: t
  shell-dirtrack-mode: t
  global-company-mode: t
  company-mode: t
  ido-everywhere: t
  global-auto-revert-mode: t
  which-function-mode: t
  winner-mode: t
  delete-selection-mode: t
  show-paren-mode: t
  electric-pair-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  prettify-symbols-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t

Recent messages:
Auto-saving...done
Deleting escape.
paredit-backslash-interactive: Wrong type argument: characterp, 134217830
Character to escape: \
Doing CD...done
Listing /ftp:rasmus@ssl.eumx.net:/... [2 times]
Doing CD...done
Listing /ftp:rasmus@ssl.eumx.net:/... [2 times]
tramp-file-name-handler: FTP Error: DIR failed: usage: ls remote-directory local-file
Undo!

Load-path shadows:
~/.emacs.d/lisp/abbrev hides /usr/share/emacs/25.0.50/lisp/abbrev
/usr/share/emacs/site-lisp/org/ox-odt hides /usr/share/emacs/25.0.50/lisp/org/ox-odt
/usr/share/emacs/site-lisp/org/ox-texinfo hides /usr/share/emacs/25.0.50/lisp/org/ox-texinfo
/usr/share/emacs/site-lisp/org/ox-publish hides /usr/share/emacs/25.0.50/lisp/org/ox-publish
/usr/share/emacs/site-lisp/org/ox-org hides /usr/share/emacs/25.0.50/lisp/org/ox-org
/usr/share/emacs/site-lisp/org/ox-latex hides /usr/share/emacs/25.0.50/lisp/org/ox-latex
/usr/share/emacs/site-lisp/org/ox-md hides /usr/share/emacs/25.0.50/lisp/org/ox-md
/usr/share/emacs/site-lisp/org/ox-man hides /usr/share/emacs/25.0.50/lisp/org/ox-man
/usr/share/emacs/site-lisp/org/ox-html hides /usr/share/emacs/25.0.50/lisp/org/ox-html
/usr/share/emacs/site-lisp/org/ox-icalendar hides /usr/share/emacs/25.0.50/lisp/org/ox-icalendar
/usr/share/emacs/site-lisp/org/ox hides /usr/share/emacs/25.0.50/lisp/org/ox
/usr/share/emacs/site-lisp/org/ox-beamer hides /usr/share/emacs/25.0.50/lisp/org/ox-beamer
/usr/share/emacs/site-lisp/org/ox-ascii hides /usr/share/emacs/25.0.50/lisp/org/ox-ascii
/usr/share/emacs/site-lisp/org/org-w3m hides /usr/share/emacs/25.0.50/lisp/org/org-w3m
/usr/share/emacs/site-lisp/org/org-table hides /usr/share/emacs/25.0.50/lisp/org/org-table
/usr/share/emacs/site-lisp/org/org-timer hides /usr/share/emacs/25.0.50/lisp/org/org-timer
/usr/share/emacs/site-lisp/org/org-protocol hides /usr/share/emacs/25.0.50/lisp/org/org-protocol
/usr/share/emacs/site-lisp/org/org-rmail hides /usr/share/emacs/25.0.50/lisp/org/org-rmail
/usr/share/emacs/site-lisp/org/org-irc hides /usr/share/emacs/25.0.50/lisp/org/org-irc
/usr/share/emacs/site-lisp/org/org-src hides /usr/share/emacs/25.0.50/lisp/org/org-src
/usr/share/emacs/site-lisp/org/org-plot hides /usr/share/emacs/25.0.50/lisp/org/org-plot
/usr/share/emacs/site-lisp/org/org-mobile hides /usr/share/emacs/25.0.50/lisp/org/org-mobile
/usr/share/emacs/site-lisp/org/org-mouse hides /usr/share/emacs/25.0.50/lisp/org/org-mouse
/usr/share/emacs/site-lisp/org/org-pcomplete hides /usr/share/emacs/25.0.50/lisp/org/org-pcomplete
/usr/share/emacs/site-lisp/org/org-mhe hides /usr/share/emacs/25.0.50/lisp/org/org-mhe
/usr/share/emacs/site-lisp/org/org-inlinetask hides /usr/share/emacs/25.0.50/lisp/org/org-inlinetask
/usr/share/emacs/site-lisp/org/org-info hides /usr/share/emacs/25.0.50/lisp/org/org-info
/usr/share/emacs/site-lisp/org/org-indent hides /usr/share/emacs/25.0.50/lisp/org/org-indent
/usr/share/emacs/site-lisp/org/org-macs hides /usr/share/emacs/25.0.50/lisp/org/org-macs
/usr/share/emacs/site-lisp/org/org-id hides /usr/share/emacs/25.0.50/lisp/org/org-id
/usr/share/emacs/site-lisp/org/org-habit hides /usr/share/emacs/25.0.50/lisp/org/org-habit
/usr/share/emacs/site-lisp/org/org-macro hides /usr/share/emacs/25.0.50/lisp/org/org-macro
/usr/share/emacs/site-lisp/org/org-gnus hides /usr/share/emacs/25.0.50/lisp/org/org-gnus
/usr/share/emacs/site-lisp/org/org-list hides /usr/share/emacs/25.0.50/lisp/org/org-list
/usr/share/emacs/site-lisp/org/org hides /usr/share/emacs/25.0.50/lisp/org/org
/usr/share/emacs/site-lisp/org/org-feed hides /usr/share/emacs/25.0.50/lisp/org/org-feed
/usr/share/emacs/site-lisp/org/org-element hides /usr/share/emacs/25.0.50/lisp/org/org-element
/usr/share/emacs/site-lisp/org/org-eshell hides /usr/share/emacs/25.0.50/lisp/org/org-eshell
/usr/share/emacs/site-lisp/org/org-footnote hides /usr/share/emacs/25.0.50/lisp/org/org-footnote
/usr/share/emacs/site-lisp/org/org-docview hides /usr/share/emacs/25.0.50/lisp/org/org-docview
/usr/share/emacs/site-lisp/org/org-datetree hides /usr/share/emacs/25.0.50/lisp/org/org-datetree
/usr/share/emacs/site-lisp/org/org-ctags hides /usr/share/emacs/25.0.50/lisp/org/org-ctags
/usr/share/emacs/site-lisp/org/org-crypt hides /usr/share/emacs/25.0.50/lisp/org/org-crypt
/usr/share/emacs/site-lisp/org/org-faces hides /usr/share/emacs/25.0.50/lisp/org/org-faces
/usr/share/emacs/site-lisp/org/org-entities hides /usr/share/emacs/25.0.50/lisp/org/org-entities
/usr/share/emacs/site-lisp/org/org-agenda hides /usr/share/emacs/25.0.50/lisp/org/org-agenda
/usr/share/emacs/site-lisp/org/org-colview hides /usr/share/emacs/25.0.50/lisp/org/org-colview
/usr/share/emacs/site-lisp/org/org-clock hides /usr/share/emacs/25.0.50/lisp/org/org-clock
/usr/share/emacs/site-lisp/org/org-compat hides /usr/share/emacs/25.0.50/lisp/org/org-compat
/usr/share/emacs/site-lisp/org/org-capture hides /usr/share/emacs/25.0.50/lisp/org/org-capture
/usr/share/emacs/site-lisp/org/org-bibtex hides /usr/share/emacs/25.0.50/lisp/org/org-bibtex
/usr/share/emacs/site-lisp/org/org-bbdb hides /usr/share/emacs/25.0.50/lisp/org/org-bbdb
/usr/share/emacs/site-lisp/org/org-attach hides /usr/share/emacs/25.0.50/lisp/org/org-attach
/usr/share/emacs/site-lisp/org/org-archive hides /usr/share/emacs/25.0.50/lisp/org/org-archive
/usr/share/emacs/site-lisp/org/ob-tangle hides /usr/share/emacs/25.0.50/lisp/org/ob-tangle
/usr/share/emacs/site-lisp/org/ob-sqlite hides /usr/share/emacs/25.0.50/lisp/org/ob-sqlite
/usr/share/emacs/site-lisp/org/ob-sql hides /usr/share/emacs/25.0.50/lisp/org/ob-sql
/usr/share/emacs/site-lisp/org/ob-table hides /usr/share/emacs/25.0.50/lisp/org/ob-table
/usr/share/emacs/site-lisp/org/ob-shen hides /usr/share/emacs/25.0.50/lisp/org/ob-shen
/usr/share/emacs/site-lisp/org/ob-screen hides /usr/share/emacs/25.0.50/lisp/org/ob-screen
/usr/share/emacs/site-lisp/org/ob-scala hides /usr/share/emacs/25.0.50/lisp/org/ob-scala
/usr/share/emacs/site-lisp/org/ob-scheme hides /usr/share/emacs/25.0.50/lisp/org/ob-scheme
/usr/share/emacs/site-lisp/org/ob-sass hides /usr/share/emacs/25.0.50/lisp/org/ob-sass
/usr/share/emacs/site-lisp/org/ob-ruby hides /usr/share/emacs/25.0.50/lisp/org/ob-ruby
/usr/share/emacs/site-lisp/org/ob-R hides /usr/share/emacs/25.0.50/lisp/org/ob-R
/usr/share/emacs/site-lisp/org/ob-ref hides /usr/share/emacs/25.0.50/lisp/org/ob-ref
/usr/share/emacs/site-lisp/org/ob-python hides /usr/share/emacs/25.0.50/lisp/org/ob-python
/usr/share/emacs/site-lisp/org/ob-plantuml hides /usr/share/emacs/25.0.50/lisp/org/ob-plantuml
/usr/share/emacs/site-lisp/org/ob-picolisp hides /usr/share/emacs/25.0.50/lisp/org/ob-picolisp
/usr/share/emacs/site-lisp/org/ob-perl hides /usr/share/emacs/25.0.50/lisp/org/ob-perl
/usr/share/emacs/site-lisp/org/ob-org hides /usr/share/emacs/25.0.50/lisp/org/ob-org
/usr/share/emacs/site-lisp/org/ob-octave hides /usr/share/emacs/25.0.50/lisp/org/ob-octave
/usr/share/emacs/site-lisp/org/ob-ocaml hides /usr/share/emacs/25.0.50/lisp/org/ob-ocaml
/usr/share/emacs/site-lisp/org/ob-mscgen hides /usr/share/emacs/25.0.50/lisp/org/ob-mscgen
/usr/share/emacs/site-lisp/org/ob-maxima hides /usr/share/emacs/25.0.50/lisp/org/ob-maxima
/usr/share/emacs/site-lisp/org/ob-matlab hides /usr/share/emacs/25.0.50/lisp/org/ob-matlab
/usr/share/emacs/site-lisp/org/ob-lisp hides /usr/share/emacs/25.0.50/lisp/org/ob-lisp
/usr/share/emacs/site-lisp/org/ob-makefile hides /usr/share/emacs/25.0.50/lisp/org/ob-makefile
/usr/share/emacs/site-lisp/org/ob-lilypond hides /usr/share/emacs/25.0.50/lisp/org/ob-lilypond
/usr/share/emacs/site-lisp/org/ob-lob hides /usr/share/emacs/25.0.50/lisp/org/ob-lob
/usr/share/emacs/site-lisp/org/ob-ledger hides /usr/share/emacs/25.0.50/lisp/org/ob-ledger
/usr/share/emacs/site-lisp/org/ob-fortran hides /usr/share/emacs/25.0.50/lisp/org/ob-fortran
/usr/share/emacs/site-lisp/org/ob-latex hides /usr/share/emacs/25.0.50/lisp/org/ob-latex
/usr/share/emacs/site-lisp/org/ob-js hides /usr/share/emacs/25.0.50/lisp/org/ob-js
/usr/share/emacs/site-lisp/org/ob-java hides /usr/share/emacs/25.0.50/lisp/org/ob-java
/usr/share/emacs/site-lisp/org/ob-keys hides /usr/share/emacs/25.0.50/lisp/org/ob-keys
/usr/share/emacs/site-lisp/org/ob-io hides /usr/share/emacs/25.0.50/lisp/org/ob-io
/usr/share/emacs/site-lisp/org/ob-haskell hides /usr/share/emacs/25.0.50/lisp/org/ob-haskell
/usr/share/emacs/site-lisp/org/ob-gnuplot hides /usr/share/emacs/25.0.50/lisp/org/ob-gnuplot
/usr/share/emacs/site-lisp/org/ob-exp hides /usr/share/emacs/25.0.50/lisp/org/ob-exp
/usr/share/emacs/site-lisp/org/ob-C hides /usr/share/emacs/25.0.50/lisp/org/ob-C
/usr/share/emacs/site-lisp/org/ob-emacs-lisp hides /usr/share/emacs/25.0.50/lisp/org/ob-emacs-lisp
/usr/share/emacs/site-lisp/org/ob hides /usr/share/emacs/25.0.50/lisp/org/ob
/usr/share/emacs/site-lisp/org/ob-eval hides /usr/share/emacs/25.0.50/lisp/org/ob-eval
/usr/share/emacs/site-lisp/org/ob-dot hides /usr/share/emacs/25.0.50/lisp/org/ob-dot
/usr/share/emacs/site-lisp/org/ob-ditaa hides /usr/share/emacs/25.0.50/lisp/org/ob-ditaa
/usr/share/emacs/site-lisp/org/ob-core hides /usr/share/emacs/25.0.50/lisp/org/ob-core
/usr/share/emacs/site-lisp/org/ob-css hides /usr/share/emacs/25.0.50/lisp/org/ob-css
/usr/share/emacs/site-lisp/org/ob-comint hides /usr/share/emacs/25.0.50/lisp/org/ob-comint
/usr/share/emacs/site-lisp/org/ob-clojure hides /usr/share/emacs/25.0.50/lisp/org/ob-clojure
/usr/share/emacs/site-lisp/org/ob-calc hides /usr/share/emacs/25.0.50/lisp/org/ob-calc
/usr/share/emacs/site-lisp/org/ob-awk hides /usr/share/emacs/25.0.50/lisp/org/ob-awk
/usr/share/emacs/site-lisp/org/ob-asymptote hides /usr/share/emacs/25.0.50/lisp/org/ob-asymptote
/usr/share/emacs/site-lisp/org/org-loaddefs hides /usr/share/emacs/25.0.50/lisp/org/org-loaddefs
/usr/share/emacs/site-lisp/org/org-version hides /usr/share/emacs/25.0.50/lisp/org/org-version
/usr/share/emacs/site-lisp/org/org-install hides /usr/share/emacs/25.0.50/lisp/org/org-install
/home/rasmus/.emacs.d/elpa/emms-20141104.1238/tq hides /usr/share/emacs/25.0.50/lisp/emacs-lisp/tq

Features:
(shadow emacsbug debug ange-ftp tramp-ftp vc-git ffap thingatpt recentf
tree-widget smex misearch multi-isearch emms-player-mpv emms-info-libtag
emms-librefm-stream emms-librefm-scrobbler emms-playlist-limit
emms-volume emms-volume-amixer emms-i18n emms-history emms-score
emms-stream-info emms-metaplaylist-mode emms-bookmarks emms-cue
emms-mode-line-icon emms-browser emms-playlist-sort emms-last-played
emms-player-xine emms-player-mpd tq emms-playing-time emms-lyrics
emms-url emms-streams emms-tag-editor emms-mark emms-mode-line
emms-cache emms-info-ogginfo emms-info-mp3info emms-info later-do
emms-playlist-mode emms-player-vlc emms-player-mplayer
emms-player-simple emms-source-playlist emms-source-file locate
emms-setup emms emms-compat org-table quail help-mode footnote autocap
cookie1 flow-fill picture rect shr pp gnus-html browse-url mm-url
diff-mode tramp-cache arc-mode archive-mode mule-util gnus-gravatar
gnus-picon sort org-indent cdlatex texmathp reftex reftex-vars org-rmail
org-mhe org-irc org-info org-gnus org-docview doc-view jka-compr
image-mode org-bibtex bibtex org-bbdb org-w3m bbdb-anniv diary-lib
diary-loaddefs org-element avl-tree key-chord org-inlinetask org
org-macro org-footnote org-pcomplete org-list org-faces org-entities
noutline outline easy-mmode org-version ob-shell ob-awk ob-org ob-octave
ob-python ob-C ob-emacs-lisp ob-fortran cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs ob-latex
ob-R ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs find-func
cal-menu calendar cal-loaddefs smiley gnus-cite mm-archive gnus-bcklg
url-http url-gw url-auth gravatar url-cache url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
url-parse url-vars mail-extr gnus-notifications gnus-fun notifications
dbus xml gnus-async qp gnus-ml disp-table gnus-topic hl-line utf-7
epa-file epa derived epg gnutls network-stream nsm starttls nnfolder
nnnil gnus-demon gnus-harvest cl bbdb-com crm bbdb bbdb-site timezone
mailalias nnir smtpmail-async smtpmail sendmail async gnus-delay
gnus-draft gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp
gnus-cache gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig
mailcap gnus-sum nndraft nnmh gnus-group gnus-undo gnus-start gnus-cloud
nnimap tls utf7 netrc parse-time gnus-spec nnmail gnus-int gnus-range
mail-source message idna dired-x dired rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev gmm-utils mailheader gnus-win nnoo gnus gnus-ems nnheader
mail-utils wid-edit gnus-switch nyan-mode server paredit flyspell ispell
cap-words superword subword company-files company-oddmuse
company-keywords company-etags etags company-gtags company-dabbrev-code
company-dabbrev company-capf company-cmake company-xcode company-clang
company-semantic company-eclim company-template company-css company-nxml
company-bbdb company-c-headers rx company-anaconda anaconda-mode f s
ucs-normalize dash tramp tramp-compat auth-source eieio byte-opt
bytecomp byte-compile cl-extra cconv eieio-core gnus-util mm-util
mail-prsvr password-cache tramp-loaddefs trampver readline-complete
shell pcomplete format-spec advice help-fns json-rpc python json comint
ansi-color company ido autorevert filenotify which-func imenu winner
ring windmove delsel paren elec-pair savehist saveplace cl-macs gv
time-date edmacro kmacro cl-loaddefs cl-lib tex-site info easymenu
package epg-config tooltip eldoc 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 elisp-mode 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 778835 109033)
 (symbols 48 53756 0)
 (miscs 40 2746 1729)
 (strings 32 180844 20191)
 (string-bytes 1 5291883)
 (vectors 16 81596)
 (vector-slots 8 2011734 224119)
 (floats 8 580 1975)
 (intervals 56 8137 12797)
 (buffers 976 80)
 (heap 1024 99311 10674))

-- 
With monopolies the cake is a lie!





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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-11-26 12:03 bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection Rasmus
@ 2014-11-26 13:35 ` Michael Albinus
  2014-11-26 23:45   ` Rasmus
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2014-11-26 13:35 UTC (permalink / raw)
  To: Rasmus; +Cc: 19192

Rasmus <rasmus@gmx.us> writes:

> Hi,

Hi Rasmus,

> I don't know if this is a feature or a bug.
>
> Michael: do you want me to write a patch or will this be a quick fix for
> you?

Likely, it is a feature. So I don't know whether we can fix this quickly.

However, if you want to investigate it, it is likely in
ange-ftp.el. Tramp doesn't care about ftp connections, it let
ange-ftp.el do the job.

A possible fix might be to give a user an option, whether global
dired-listing-switches shall be used everywhere, or whether there shall
be special settings connection-oriented.

> Thanks,
> Rasmus

Best regards, Michael.





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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-11-26 13:35 ` Michael Albinus
@ 2014-11-26 23:45   ` Rasmus
  2014-11-29 10:42     ` Michael Albinus
  0 siblings, 1 reply; 14+ messages in thread
From: Rasmus @ 2014-11-26 23:45 UTC (permalink / raw)
  To: michael.albinus; +Cc: 19192

Hi,

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

> Rasmus <rasmus@gmx.us> writes:
>> I don't know if this is a feature or a bug.
>>
>> Michael: do you want me to write a patch or will this be a quick fix for
>> you?
>
> Likely, it is a feature. So I don't know whether we can fix this quickly.

I agree.

> However, if you want to investigate it, it is likely in
> ange-ftp.el. Tramp doesn't care about ftp connections, it let
> ange-ftp.el do the job.

Thanks for pointing this out.

> A possible fix might be to give a user an option, whether global
> dired-listing-switches shall be used everywhere, or whether there shall
> be special settings connection-oriented.

So it turns out that arguments are tested via `ange-ftp-switches-ok'.
So the easiest fix would probably be to extend this function to do a
better job of checking.  Unfortunately, I don't know if one can easily
predict which ls commands will be understood and which not?  E.g. does
ftp ls depend on the host systems version of ls?

Thanks,
Rasmus

-- 
Summon the Mothership!







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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-11-26 23:45   ` Rasmus
@ 2014-11-29 10:42     ` Michael Albinus
  2014-11-29 11:16       ` Rasmus
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2014-11-29 10:42 UTC (permalink / raw)
  To: Rasmus; +Cc: 19192

Rasmus <rasmus@gmx.us> writes:

> Hi,

Hi Rasmus,

>> A possible fix might be to give a user an option, whether global
>> dired-listing-switches shall be used everywhere, or whether there shall
>> be special settings connection-oriented.
>
> So it turns out that arguments are tested via `ange-ftp-switches-ok'.
> So the easiest fix would probably be to extend this function to do a
> better job of checking.  Unfortunately, I don't know if one can easily
> predict which ls commands will be understood and which not?  E.g. does
> ftp ls depend on the host systems version of ls?

I don't know exactly. But I guess the most stable patch would be to not
expect too much from ftp's ls.

> Thanks,
> Rasmus

Best regards, Michael.





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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-11-29 10:42     ` Michael Albinus
@ 2014-11-29 11:16       ` Rasmus
  2014-11-29 12:21         ` Rasmus
  2014-11-30 11:10         ` Michael Albinus
  0 siblings, 2 replies; 14+ messages in thread
From: Rasmus @ 2014-11-29 11:16 UTC (permalink / raw)
  To: michael.albinus; +Cc: 19192

Hi,

Sorry for asking so many questions.

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

> Rasmus <rasmus@gmx.us> writes:
>>> A possible fix might be to give a user an option, whether global
>>> dired-listing-switches shall be used everywhere, or whether there shall
>>> be special settings connection-oriented.
>>
>> So it turns out that arguments are tested via `ange-ftp-switches-ok'.
>> So the easiest fix would probably be to extend this function to do a
>> better job of checking.  Unfortunately, I don't know if one can easily
>> predict which ls commands will be understood and which not?  E.g. does
>> ftp ls depend on the host systems version of ls?
>
> I don't know exactly. But I guess the most stable patch would be to not
> expect too much from ftp's ls.

So according to the note in `ange-ftp-get-files' there's the following
node on using dired-actual-switches or dired-listing-switches

    ;; This is an efficiency hack. We try to
    ;; anticipate what sort of listing dired
    ;; might want, and cache just such a listing.

Switches are checked with `ange-ftp-switches-ok'.  (man "sftp") has a nice list of
switches supported.  Unfortunately, I don't really find anything on
supported ls in the manpage of ftp or the info manual...

Option I: I can limit accepted ls flags by ange-ftp to the subset
supported by sftp.  

Option I+: I could add a defcustom to allow the current more liberal
behavior akin to ange-ftp-passive-host-alist and
ange-ftp-try-passive-mode.

Option II would be to add build-in support for something like the
--group-directories-first in dired, since now, if scrub off
--group-directories-first, a dired-ftp buffer will look different from a
local dired buffer...

For now I will go with Option I.

Thanks,
Rasmus

-- 
The Kids call him Billy the Saint






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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-11-29 11:16       ` Rasmus
@ 2014-11-29 12:21         ` Rasmus
  2014-11-29 12:47           ` Rasmus
  2014-11-30 11:10         ` Michael Albinus
  1 sibling, 1 reply; 14+ messages in thread
From: Rasmus @ 2014-11-29 12:21 UTC (permalink / raw)
  To: michael.albinus; +Cc: 19192

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

Rasmus <rasmus@gmx.us> writes:

> For now I will go with Option I.

Well, turned out to be a bad idea.  Instead I tested all flags in (man
"ls") and exclude the flags that caused trouble.  Note, I only have one
ftp to test against. . .  I'm assuming this one is somewhat common.

Also, a limitation of the `ange-ftp-switches-ok' is that it's too
destructive: I.e. rather than removing offending ls-flags, it will
entirely disregard the whole thing.  I guess that's another patch,
though.

If you find the patch OK, feel free to submit.  Otherwise, let me know
what to improve.

Thanks,
Rasmus

-- 
The right to be left alone is a human right

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ange-ftp.el-Disallow-more-dired-ls-flags.patch --]
[-- Type: text/x-diff, Size: 2545 bytes --]

From 6fd921e7d7deb88c5a3f172022b64a0539edbdd6 Mon Sep 17 00:00:00 2001
From: Rasmus <w530@pank.eu>
Date: Sat, 29 Nov 2014 13:12:10 +0100
Subject: [PATCH] ange-ftp.el: Disallow more dired ls-flags

* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
trouble with ls over ftp.  These flags result in ls returning no
output, causing Tramp-breakage.

Fixes: debbugs:19192
---
 lisp/ChangeLog       |  6 ++++++
 lisp/net/ange-ftp.el | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2a450a7..7d0992e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-29  Rasmus Pank Roulund  <emacs@pank.eu>
+
+	* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
+	trouble with ls over ftp.  These flags result in ls returning no
+	output, causing Tramp-breakage.  (bug#19192)
+
 2014-11-29  Stephen Berman  <stephen.berman@gmx.net>
 	    Stefan Monnier  <monnier@iro.umontreal.ca>
 
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index d7632ed..a2b0b46 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -2831,16 +2831,26 @@ match subdirectories as well.")
 		      files ange-ftp-files-hashtable)))
 
 (defun ange-ftp-switches-ok (switches)
-  "Return SWITCHES (a string) if suitable for our use."
+  "Return SWITCHES (a string) if suitable for use with ls over ftp."
   (and (stringp switches)
        ;; We allow the A switch, which lists all files except "." and
        ;; "..".  This is OK because we manually insert these entries
        ;; in the hash table.
        (string-match
 	"--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
+       ;; Allow flags starting with a single dash
        (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
+       ;; Disallow recursive flag
        (not (string-match
 	     "--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
+       ;; Disallow most long flags from (man "ls"), version 8.23 of July 2014.
+       (not (string-match
+             (concat
+              "--\\(block-size\\|color\\|format\\|group-directories-first\\|"
+              "human-readable\\|dereference-command-line\\|hide\\|indicator-style\\|"
+              "dereference-command-line-symlink-to-dir\\|inode\\|ignore\\|dereference\\|"
+              "numeric-uid-gid\\|indicator-style\\|hide-control-chars\\|quoting-style\\|"
+              "sort\\|time\\|time-style\\|width\\)")))
        switches))
 
 (defun ange-ftp-get-files (directory &optional no-error)
-- 
2.1.3


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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-11-29 12:21         ` Rasmus
@ 2014-11-29 12:47           ` Rasmus
  0 siblings, 0 replies; 14+ messages in thread
From: Rasmus @ 2014-11-29 12:47 UTC (permalink / raw)
  To: michael.albinus; +Cc: 19192

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

Rasmus <rasmus@gmx.us> writes:

> Rasmus <rasmus@gmx.us> writes:
>
>> For now I will go with Option I.
>
> Well, turned out to be a bad idea.  Instead I tested all flags in (man
> "ls") and exclude the flags that caused trouble.  Note, I only have one
> ftp to test against. . .  I'm assuming this one is somewhat common.
>
> Also, a limitation of the `ange-ftp-switches-ok' is that it's too
> destructive: I.e. rather than removing offending ls-flags, it will
> entirely disregard the whole thing.  I guess that's another patch,
> though.
>
> If you find the patch OK, feel free to submit.  Otherwise, let me know
> what to improve.

This patch uses the "right" email for the commit (I don't know if this
matters much).  Otherwise identical.

-- 
The Kids call him Billy the Saint

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ange-ftp.el-Disallow-more-dired-ls-flags.patch --]
[-- Type: text/x-diff, Size: 2549 bytes --]

From 6fd921e7d7deb88c5a3f172022b64a0539edbdd6 Mon Sep 17 00:00:00 2001
From: Rasmus <w530@pank.eu>
Date: Sat, 29 Nov 2014 13:12:10 +0100
Subject: [PATCH 1/2] ange-ftp.el: Disallow more dired ls-flags

* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
trouble with ls over ftp.  These flags result in ls returning no
output, causing Tramp-breakage.

Fixes: debbugs:19192
---
 lisp/ChangeLog       |  6 ++++++
 lisp/net/ange-ftp.el | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2a450a7..7d0992e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-29  Rasmus Pank Roulund  <emacs@pank.eu>
+
+	* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
+	trouble with ls over ftp.  These flags result in ls returning no
+	output, causing Tramp-breakage.  (bug#19192)
+
 2014-11-29  Stephen Berman  <stephen.berman@gmx.net>
 	    Stefan Monnier  <monnier@iro.umontreal.ca>
 
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index d7632ed..a2b0b46 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -2831,16 +2831,26 @@ match subdirectories as well.")
 		      files ange-ftp-files-hashtable)))
 
 (defun ange-ftp-switches-ok (switches)
-  "Return SWITCHES (a string) if suitable for our use."
+  "Return SWITCHES (a string) if suitable for use with ls over ftp."
   (and (stringp switches)
        ;; We allow the A switch, which lists all files except "." and
        ;; "..".  This is OK because we manually insert these entries
        ;; in the hash table.
        (string-match
 	"--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
+       ;; Allow flags starting with a single dash
        (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
+       ;; Disallow recursive flag
        (not (string-match
 	     "--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
+       ;; Disallow most long flags from (man "ls"), version 8.23 of July 2014.
+       (not (string-match
+             (concat
+              "--\\(block-size\\|color\\|format\\|group-directories-first\\|"
+              "human-readable\\|dereference-command-line\\|hide\\|indicator-style\\|"
+              "dereference-command-line-symlink-to-dir\\|inode\\|ignore\\|dereference\\|"
+              "numeric-uid-gid\\|indicator-style\\|hide-control-chars\\|quoting-style\\|"
+              "sort\\|time\\|time-style\\|width\\)")))
        switches))
 
 (defun ange-ftp-get-files (directory &optional no-error)
-- 
2.1.3


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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-11-29 11:16       ` Rasmus
  2014-11-29 12:21         ` Rasmus
@ 2014-11-30 11:10         ` Michael Albinus
  2014-11-30 12:43           ` Rasmus
  1 sibling, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2014-11-30 11:10 UTC (permalink / raw)
  To: Rasmus; +Cc: 19192

Rasmus <rasmus@gmx.us> writes:

> Hi,

Hi,

> Sorry for asking so many questions.

No problem. That's why we have debbugs that we can discuss the problem.

> So according to the note in `ange-ftp-get-files' there's the following
> node on using dired-actual-switches or dired-listing-switches
>
>     ;; This is an efficiency hack. We try to
>     ;; anticipate what sort of listing dired
>     ;; might want, and cache just such a listing.
>
> Switches are checked with `ange-ftp-switches-ok'.  (man "sftp") has a
> nice list of
> switches supported.  Unfortunately, I don't really find anything on
> supported ls in the manpage of ftp or the info manual...
>
> Option I: I can limit accepted ls flags by ange-ftp to the subset
> supported by sftp.  
>
> Option I+: I could add a defcustom to allow the current more liberal
> behavior akin to ange-ftp-passive-host-alist and
> ange-ftp-try-passive-mode.
>
> Option II would be to add build-in support for something like the
> --group-directories-first in dired, since now, if scrub off
> --group-directories-first, a dired-ftp buffer will look different from a
> local dired buffer...
>
> For now I will go with Option I.

Well, I'm a little bit confused. In the beginning, you have spoken about
"ftp". Now you've switched to "sftp". These are very different cases,
and ange-ftp.el is *not* responsible for sftp connections.

Could you, please, clarify?

> Thanks,
> Rasmus

Best regards, Michael.





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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-11-30 11:10         ` Michael Albinus
@ 2014-11-30 12:43           ` Rasmus
  2014-12-09 13:56             ` Michael Albinus
  0 siblings, 1 reply; 14+ messages in thread
From: Rasmus @ 2014-11-30 12:43 UTC (permalink / raw)
  To: michael.albinus; +Cc: 19192

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

Hi,

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

>> So according to the note in `ange-ftp-get-files' there's the following
>> node on using dired-actual-switches or dired-listing-switches
>>
>>     ;; This is an efficiency hack. We try to
>>     ;; anticipate what sort of listing dired
>>     ;; might want, and cache just such a listing.
>>
>> Switches are checked with `ange-ftp-switches-ok'.  (man "sftp") has a
>> nice list of
>> switches supported.  Unfortunately, I don't really find anything on
>> supported ls in the manpage of ftp or the info manual...
>>
>> Option I: I can limit accepted ls flags by ange-ftp to the subset
>> supported by sftp.  
>>
>> Option I+: I could add a defcustom to allow the current more liberal
>> behavior akin to ange-ftp-passive-host-alist and
>> ange-ftp-try-passive-mode.
>>
>> Option II would be to add build-in support for something like the
>> --group-directories-first in dired, since now, if scrub off
>> --group-directories-first, a dired-ftp buffer will look different from a
>> local dired buffer...
>>
>> For now I will go with Option I.
>
> Well, I'm a little bit confused. In the beginning, you have spoken about
> "ftp". Now you've switched to "sftp". These are very different cases,
> and ange-ftp.el is *not* responsible for sftp connections.
>
> Could you, please, clarify?

That comment is obsolete.  See why here:

     http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19192#20

I tried all long commands with my ftp server (Debian-hosted) and discard
the ones that breaks ls over ftp.  

Feel free to try the attached patch.

Cheers,
Rasmus

-- 
If you can mix business and politics wonderful things can happen!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ange-ftp.el-Disallow-more-dired-ls-flags.patch --]
[-- Type: text/x-diff, Size: 2541 bytes --]

From 6fd921e7d7deb88c5a3f172022b64a0539edbdd6 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Sat, 29 Nov 2014 13:12:10 +0100
Subject: [PATCH] ange-ftp.el: Disallow more dired ls-flags

* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
trouble with ls over ftp.  These flags result in ls returning no
output, causing Tramp-breakage.

Fixes: debbugs:19192
---
 lisp/ChangeLog       |  6 ++++++
 lisp/net/ange-ftp.el | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2a450a7..7d0992e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-29  Rasmus Pank Roulund  <emacs@pank.eu>
+
+	* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
+	trouble with ls over ftp.  These flags result in ls returning no
+	output, causing Tramp-breakage.  (bug#19192)
+
 2014-11-29  Stephen Berman  <stephen.berman@gmx.net>
 	    Stefan Monnier  <monnier@iro.umontreal.ca>

diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index d7632ed..a2b0b46 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -2831,16 +2831,26 @@ match subdirectories as well.")
 		      files ange-ftp-files-hashtable)))

 (defun ange-ftp-switches-ok (switches)
-  "Return SWITCHES (a string) if suitable for our use."
+  "Return SWITCHES (a string) if suitable for use with ls over ftp."
   (and (stringp switches)
        ;; We allow the A switch, which lists all files except "." and
        ;; "..".  This is OK because we manually insert these entries
        ;; in the hash table.
        (string-match
 	"--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
+       ;; Allow flags starting with a single dash
        (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
+       ;; Disallow recursive flag
        (not (string-match
 	     "--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
+       ;; Disallow most long flags from (man "ls"), version 8.23 of July 2014.
+       (not (string-match
+             (concat
+              "--\\(block-size\\|color\\|format\\|group-directories-first\\|"
+              "human-readable\\|dereference-command-line\\|hide\\|indicator-style\\|"
+              "dereference-command-line-symlink-to-dir\\|inode\\|ignore\\|dereference\\|"
+              "numeric-uid-gid\\|indicator-style\\|hide-control-chars\\|quoting-style\\|"
+              "sort\\|time\\|time-style\\|width\\)")))
        switches))

 (defun ange-ftp-get-files (directory &optional no-error)
--
2.1.3

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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-11-30 12:43           ` Rasmus
@ 2014-12-09 13:56             ` Michael Albinus
  2014-12-10 13:16               ` Rasmus
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2014-12-09 13:56 UTC (permalink / raw)
  To: Rasmus; +Cc: 19192

Rasmus <rasmus@gmx.us> writes:

> Hi,

Hi Rasmus,

> That comment is obsolete.  See why here:
>
>      http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19192#20
>
> I tried all long commands with my ftp server (Debian-hosted) and discard
> the ones that breaks ls over ftp.  
>
> Feel free to try the attached patch.

Sorry, it took a while until I found the time to have a look on your
patch.

So far it seems to be OK, but wouldn't it be safer to disallow all
options to ftp which start with "--"? I understand that you have checked
it with your ftp client, but you cannot assume that everybody uses the same
version of ftp and ls as you do. Samr for the ftp server.

> Cheers,
> Rasmus

Best regards, Michael.





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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-12-09 13:56             ` Michael Albinus
@ 2014-12-10 13:16               ` Rasmus
  2014-12-10 14:15                 ` Andreas Schwab
  0 siblings, 1 reply; 14+ messages in thread
From: Rasmus @ 2014-12-10 13:16 UTC (permalink / raw)
  To: michael.albinus; +Cc: 19192

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

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

> So far it seems to be OK, but wouldn't it be safer to disallow all
> options to ftp which start with "--"? I understand that you have checked
> it with your ftp client, but you cannot assume that everybody uses the same
> version of ftp and ls as you do. Samr for the ftp server.

As you prefer.  

This patch disallow
   (string-match "--\\w\\{2,\\}" switches)
which should be enough to capture switches starting with --, I guess.

—Rasmus

-- 
The right to be left alone is a human right

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ange-ftp.el-Disallow-more-dired-ls-flags.patch --]
[-- Type: text/x-diff, Size: 2134 bytes --]

From 55bf708060ddf05a87df4f1f22185aceac74d9c6 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Sat, 29 Nov 2014 13:12:10 +0100
Subject: [PATCH] ange-ftp.el: Disallow more dired ls-flags

* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
trouble with ls over ftp.  These flags result in ls returning no
output, causing Tramp-breakage.

Fixes: debbugs:19192
---
 lisp/ChangeLog       | 6 ++++++
 lisp/net/ange-ftp.el | 8 ++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 454ee00..09b64f5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-29  Rasmus Pank Roulund  <emacs@pank.eu>
+
+	* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
+	trouble with ls over ftp.  These flags result in ls returning no
+	output, causing Tramp-breakage.  (bug#19192)
+
 2014-12-10  Andreas Schwab  <schwab@suse.de>
 
 	* files.el (file-tree-walk): Use file-name-as-directory
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index d7632ed..5e9bc27 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -2831,16 +2831,20 @@ match subdirectories as well.")
 		      files ange-ftp-files-hashtable)))
 
 (defun ange-ftp-switches-ok (switches)
-  "Return SWITCHES (a string) if suitable for our use."
+  "Return SWITCHES (a string) if suitable for use with ls over ftp."
   (and (stringp switches)
        ;; We allow the A switch, which lists all files except "." and
        ;; "..".  This is OK because we manually insert these entries
        ;; in the hash table.
        (string-match
 	"--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
+       ;; Allow flags starting with a single dash
        (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
+       ;; Disallow recursive flag
        (not (string-match
-	     "--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
+	     "\\(\\`\\| \\)-[[:alpha:]]*R" switches))
+       ;; Disallow long flags.
+       (not (string-match "--\\w\\{2,\\}"))
        switches))
 
 (defun ange-ftp-get-files (directory &optional no-error)
-- 
2.1.3


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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-12-10 13:16               ` Rasmus
@ 2014-12-10 14:15                 ` Andreas Schwab
  2014-12-10 15:28                   ` Rasmus
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Schwab @ 2014-12-10 14:15 UTC (permalink / raw)
  To: Rasmus; +Cc: 19192, michael.albinus

Rasmus <rasmus@gmx.us> writes:

> diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
> index d7632ed..5e9bc27 100644
> --- a/lisp/net/ange-ftp.el
> +++ b/lisp/net/ange-ftp.el
> @@ -2831,16 +2831,20 @@ match subdirectories as well.")
>  		      files ange-ftp-files-hashtable)))
>  
>  (defun ange-ftp-switches-ok (switches)
> -  "Return SWITCHES (a string) if suitable for our use."
> +  "Return SWITCHES (a string) if suitable for use with ls over ftp."
>    (and (stringp switches)
>         ;; We allow the A switch, which lists all files except "." and
>         ;; "..".  This is OK because we manually insert these entries
>         ;; in the hash table.
>         (string-match
>  	"--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
> +       ;; Allow flags starting with a single dash
>         (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
> +       ;; Disallow recursive flag
>         (not (string-match
> -	     "--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
> +	     "\\(\\`\\| \\)-[[:alpha:]]*R" switches))
> +       ;; Disallow long flags.
> +       (not (string-match "--\\w\\{2,\\}"))

This contradicts the first string-match.

-- 
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] 14+ messages in thread

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-12-10 14:15                 ` Andreas Schwab
@ 2014-12-10 15:28                   ` Rasmus
  2014-12-10 16:49                     ` Michael Albinus
  0 siblings, 1 reply; 14+ messages in thread
From: Rasmus @ 2014-12-10 15:28 UTC (permalink / raw)
  To: schwab; +Cc: 19192, michael.albinus

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

Andreas Schwab <schwab@suse.de> writes:

> Rasmus <rasmus@gmx.us> writes:
>
>> diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
>> index d7632ed..5e9bc27 100644
>> --- a/lisp/net/ange-ftp.el
>> +++ b/lisp/net/ange-ftp.el
>> @@ -2831,16 +2831,20 @@ match subdirectories as well.")
>>  		      files ange-ftp-files-hashtable)))
>>  
>>  (defun ange-ftp-switches-ok (switches)
>> -  "Return SWITCHES (a string) if suitable for our use."
>> +  "Return SWITCHES (a string) if suitable for use with ls over ftp."
>>    (and (stringp switches)
>>         ;; We allow the A switch, which lists all files except "." and
>>         ;; "..".  This is OK because we manually insert these entries
>>         ;; in the hash table.
>>         (string-match
>>  	"--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
>> +       ;; Allow flags starting with a single dash
>>         (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
>> +       ;; Disallow recursive flag
>>         (not (string-match
>> -	     "--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
>> +	     "\\(\\`\\| \\)-[[:alpha:]]*R" switches))
>> +       ;; Disallow long flags.
>> +       (not (string-match "--\\w\\{2,\\}"))
>
> This contradicts the first string-match.

You are right.

How about this one: allow --(almost-)all for legacy reasons.  Disallow
other long flags.  Allow short flag as long as their is an "l" and not an
"R"?  (At least that was the intention).

—Rasmus

-- 
Together we will make the possible totalllly impossible!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ange-ftp.el-Disallow-more-dired-ls-flags.patch --]
[-- Type: text/x-diff, Size: 2526 bytes --]

From 07f99a06a30e271989a27dc58a2db54602d60e51 Mon Sep 17 00:00:00 2001
From: rasmus <x200s@pank.eu>
Date: Wed, 10 Dec 2014 16:18:00 +0100
Subject: [PATCH] ange-ftp.el: Disallow more dired ls-flags

* net/ange-ftp.el (ange-ftp-switches-ok): Disallow most lonng flags,
  as they may cause Tramp-breakage.

Fixes: debbugs:19192
---
 lisp/ChangeLog       |  6 ++++++
 lisp/net/ange-ftp.el | 20 ++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 454ee00..09b64f5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-29  Rasmus Pank Roulund  <emacs@pank.eu>
+
+	* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
+	trouble with ls over ftp.  These flags result in ls returning no
+	output, causing Tramp-breakage.  (bug#19192)
+
 2014-12-10  Andreas Schwab  <schwab@suse.de>
 
 	* files.el (file-tree-walk): Use file-name-as-directory
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index d7632ed..db79c0d 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -2831,16 +2831,24 @@ match subdirectories as well.")
 		      files ange-ftp-files-hashtable)))
 
 (defun ange-ftp-switches-ok (switches)
-  "Return SWITCHES (a string) if suitable for our use."
+  "Return SWITCHES (a string) if suitable for use with ls over ftp."
   (and (stringp switches)
-       ;; We allow the A switch, which lists all files except "." and
-       ;; "..".  This is OK because we manually insert these entries
-       ;; in the hash table.
+       ;; We allow the --almost-all switch, which lists all files
+       ;; except "." and "..".  This is OK because we manually
+       ;; insert these entries in the hash table.
        (string-match
-	"--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
+        "--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]"
+        switches)
+       ;; Disallow other long flags except --(almost-)all.
+       (not (string-match "\\(\\`\\| \\)--\\w+"
+                          (replace-regexp-in-string
+                           "--\\(almost-\\)?all\\>" ""
+                           switches)))
+       ;; Must include 'l'.
        (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
+       ;; Disallow recursive flag.
        (not (string-match
-	     "--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
+             "\\(\\`\\| \\)-[[:alpha:]]*R" switches))
        switches))
 
 (defun ange-ftp-get-files (directory &optional no-error)
-- 
2.1.3


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

* bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection
  2014-12-10 15:28                   ` Rasmus
@ 2014-12-10 16:49                     ` Michael Albinus
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Albinus @ 2014-12-10 16:49 UTC (permalink / raw)
  To: Rasmus; +Cc: schwab, 19192-done

Rasmus <rasmus@gmx.us> writes:

> How about this one: allow --(almost-)all for legacy reasons.  Disallow
> other long flags.  Allow short flag as long as their is an "l" and not an
> "R"?  (At least that was the intention).

Looks good. I've committed it to the trunk, closing the bug.

> —Rasmus

Thanks, and best regards, Michael.





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

end of thread, other threads:[~2014-12-10 16:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-26 12:03 bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection Rasmus
2014-11-26 13:35 ` Michael Albinus
2014-11-26 23:45   ` Rasmus
2014-11-29 10:42     ` Michael Albinus
2014-11-29 11:16       ` Rasmus
2014-11-29 12:21         ` Rasmus
2014-11-29 12:47           ` Rasmus
2014-11-30 11:10         ` Michael Albinus
2014-11-30 12:43           ` Rasmus
2014-12-09 13:56             ` Michael Albinus
2014-12-10 13:16               ` Rasmus
2014-12-10 14:15                 ` Andreas Schwab
2014-12-10 15:28                   ` Rasmus
2014-12-10 16:49                     ` 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).