1. 18 Jul, 2021 1 commit
    • Michael Albinus's avatar
      Make remote file locks more robust · 7075ebbf
      Michael Albinus authored
      * lisp/net/tramp.el (tramp-handle-write-region):
      * lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
      * lisp/net/tramp-smb.el (tramp-smb-handle-write-region):
      * lisp/net/tramp-sshfs.el (tramp-sshfs-handle-write-region):
      Make file locks more robust.
      
      * test/lisp/net/tramp-tests.el (tramp-test39-make-lock-file-name):
      Rename and extend.
      7075ebbf
  2. 13 Jul, 2021 1 commit
    • Michael Albinus's avatar
      Add remote-file-name-inhibit-locks · cce84822
      Michael Albinus authored
      * doc/emacs/files.texi (Interlocking):
      * doc/lispref/files.texi (File Locks):
      * doc/misc/tramp.texi (Auto-save File Lock and Backup):
      Add remote-file-name-inhibit-locks.
      
      * etc/NEWS: New user option 'remote-file-name-inhibit-locks'.
      
      * lisp/files.el (remote-file-name-inhibit-locks): New defcustom.
      
      * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
      * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
      * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
      * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
      * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
      * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
      Use `tramp-handle-make-lock-file-name'.
      
      * lisp/net/tramp.el (tramp-allow-unsafe-temporary-files): Fix docstring.
      (tramp-handle-make-lock-file-name): New defun.
      
      * test/lisp/net/tramp-tests.el (tramp-test39-lock-file): Extend test.
      cce84822
  3. 12 Jul, 2021 1 commit
    • Michael Albinus's avatar
      Fix a problem with tramp-*-process-file · bfd15953
      Michael Albinus authored
      * lisp/net/tramp-adb.el (tramp-adb-handle-process-file):
      * lisp/net/tramp-sh.el (tramp-sh-handle-process-file):
      * lisp/net/tramp-smb.el (tramp-smb-handle-process-file):
      * lisp/net/tramp-sshfs.el (tramp-sshfs-handle-process-file):
      Use `(expand-file-name default-directory)'.
      bfd15953
  4. 11 Jul, 2021 1 commit
    • Michael Albinus's avatar
      Use `auto-save-file-name-p' in tramp-*-write-region · ad6ad164
      Michael Albinus authored
      * lisp/net/tramp.el (tramp-handle-write-region):
      * lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
      * lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
      * lisp/net/tramp-smb.el (tramp-smb-handle-write-region):
      * lisp/net/tramp-sshfs.el (tramp-sshfs-handle-write-region):
      Use `auto-save-file-name-p'.
      ad6ad164
  5. 08 Jul, 2021 2 commits
    • Michael Albinus's avatar
      Code cleanup wrt file locks · a6a92e3a
      Michael Albinus authored
      * lisp/files.el (make-lock-file-name): Fix docstring.
      
      * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
      * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
      * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
      * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
      * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
      * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
      * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
      Add `make-lock-file-name'.
      
      * lisp/net/tramp.el (tramp-file-name-for-operation):
      Add `make-lock-file-name'.
      (tramp-handle-unlock-file): Call `userlock--handle-unlock-error'
      in case of error.
      
      * src/buffer.c (Frestore_buffer_modified_p):
      * src/editfns.c (Freplace_buffer_contents):
      * src/fileio.c (Finsert_file_contents, write_region): Call Funlock_file.
      
      * src/filelock.c (unlock_file): Rename from unlock_file_body.
      Remove the other declarations of unlock_file.  Move file name
      handler check to ...
      (Funlock_file): ... here.  Adapt argument numbers.  Call
      unlock_file wrapped by internal_condition_case.
      (Flock_file): Adapt argument numbers.
      (unlock_all_files, Funlock_buffer, unlock_buffer): Call Funlock_file.
      
      * src/lisp.h (unlock_file): Remove.
      a6a92e3a
    • Michael Albinus's avatar
      Some further adaptions wrt Tramp file name locks · 6d580b00
      Michael Albinus authored
      * lisp/files.el (files--transform-file-name): Rename from
      `auto-save--transform-file-name'.  Wrap with `save-match-data'.
      (make-auto-save-file-name): Use it.
      (make-lock-file-name): Use it.  Call file name handler.
      
      * lisp/net/tramp.el (tramp-handle-write-region):
      * lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
      * lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
      * lisp/net/tramp-smb.el (tramp-smb-handle-write-region):
      Suppress file lock for temporary file.
      
      * lisp/net/tramp-compat.el (tramp-compat-make-lock-file-name):
      New defalias.
      
      * lisp/net/tramp.el (tramp-get-lock-file)
      (tramp-handle-lock-file, tramp-handle-unlock-file): Use it.
      (tramp-make-lock-name): Remove.
      
      * test/lisp/filenotify-tests.el (file-notify-test03-events-remote):
      Tag it :unstable temporarily.
      6d580b00
  6. 07 Jul, 2021 1 commit
    • Michael Albinus's avatar
      Implement file locks for remote files (Bug#49261) · d35868be
      Michael Albinus authored
      * doc/lispref/files.texi (Magic File Names): Add file-locked-p,
      lock-file and unlock-file.
      
      * etc/NEWS: Tramp supports file locks now.
      
      * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      (tramp-adb-handle-write-region): Handle LOCKNAME.
      
      * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      
      * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      (tramp-crypt-handle-file-locked-p, tramp-crypt-handle-lock-file)
      (tramp-crypt-handle-unlock-file): New defun.
      
      * lisp/net/tramp-fuse.el (tramp-fuse-mounted-p): Simplify.
      (tramp-fuse-unmount): New defun.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      (tramp-gvfs-maybe-open-connection): Set "lock-pid" connection property.
      
      * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      (tramp-rclone-maybe-open-connection): Set "lock-pid" connection property.
      
      * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      (tramp-sh-handle-write-region): Handle LOCKNAME.
      
      * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      (tramp-smb-handle-copy-directory): Use `sleep-for'.
      (tramp-smb-handle-write-region): Handle LOCKNAME.
      
      * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      (tramp-sshfs-handle-write-region): Handle LOCKNAME.
      (tramp-sshfs-maybe-open-connection): Set "lock-pid" connection property.
      
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      (tramp-sudoedit-maybe-open-connection):
      Set "lock-pid" connection property.
      
      * lisp/net/tramp.el (tramp-file-name-for-operation):
      Add `file-locked-p', `lock-file' and `unlock-file'.
      (tramp-make-lock-name, tramp-get-lock-file, tramp-get-lock-pid)
      (tramp-handle-file-locked-p, tramp-handle-lock-file)
      (tramp-handle-unlock-file): New defuns.
      (tramp-lock-file-contents-regexp): New regexp.
      (tramp-handle-write-region): Handle LOCKNAME.
      
      * src/filelock.c (lock_file, unlock_file_body, Ffile_locked_p):
      Call handler if exists.
      (Flock_file, Funlock_file): New defuns.
      (Qlock_file, Qunlock_file, Qfile_locked_p): Declare symbols.
      (Slock_file, Sunlock_file): Declare subroutines.
      
      * test/lisp/net/tramp-archive-tests.el
      (tramp-archive-test40-make-nearby-temp-file)
      (tramp-archive-test43-file-system-info): Rename.
      
      * test/lisp/net/tramp-tests.el (top): Set `create-lockfiles' to nil.
      (tramp--test-fuse-p): New defun.
      (tramp-test14-delete-directory): Use it.
      (tramp-test39-lock-file): New test.
      (tramp-test40-make-nearby-temp-file)
      (tramp-test41-special-characters)
      (tramp-test41-special-characters-with-stat)
      (tramp-test41-special-characters-with-perl)
      (tramp-test41-special-characters-with-ls, tramp-test42-utf8)
      (tramp-test42-utf8-with-stat, tramp-test42-utf8-with-perl)
      (tramp-test42-utf8-with-ls, tramp-test43-file-system-info)
      (tramp-test44-asynchronous-requests, tramp-test45-auto-load)
      (tramp-test45-delay-load, tramp-test45-recursive-load)
      (tramp-test45-remote-load-path, tramp-test46-unload): Rename.
      (tramp--test-special-characters, tramp--test-utf8)
      (tramp--test-asynchronous-requests-timeout): Modify docstring.
      d35868be
  7. 05 Jul, 2021 1 commit
    • Michael Albinus's avatar
      Don't use LOCKNAME for temp files in Tramp (Bug#49406) · 579b0c00
      Michael Albinus authored
      * lisp/net/tramp.el (tramp-handle-write-region):
      * lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
      * lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
      * lisp/net/tramp-smb.el (tramp-smb-handle-write-region):
      * lisp/net/tramp-sshfs.el (tramp-sshfs-handle-write-region):
      Don't use LOCKNAME for temp file.  (Bug#49406)
      
      * test/lisp/shadowfile-tests.el (password-cache-expiry):
      Set `shadow-debug' also on emba.
      579b0c00
  8. 13 Mar, 2021 1 commit
    • Michael Albinus's avatar
      Remove ;;;###tramp-autoload cookie from Tramp defcustoms (Bug#47063) · 695f6792
      Michael Albinus authored
      * lisp/net/tramp-crypt.el (tramp-crypt-enabled-p): New defun.
      (tramp-crypt-add-directory, tramp-crypt-remove-directory):
      Add property `completion-predicate'.
      
      * lisp/net/tramp-sh.el (tramp-terminal-type, tramp-remote-path)
      (tramp-remote-process-environment): Remove.  Move them to ...
      
      * lisp/net/tramp.el: ... here.
      695f6792
  9. 18 Feb, 2021 1 commit
    • Mattias Engdegård's avatar
      Fix typos · de15ca7d
      Mattias Engdegård authored
      * doc/lispref/display.texi (Size of Displayed Text):
      * doc/lispref/windows.texi (Buffer Display Action Functions):
      * etc/NEWS:
      * etc/ORG-NEWS (Org-Attach has been refactored and extended):
      * lisp/battery.el (display-battery-mode, battery--upower-subsribe):
      * lisp/calendar/parse-time.el:
      * lisp/dired-x.el:
      * lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
      * lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
      (eldoc-documentation-strategy):
      * lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
      * lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
      (gnus-search-parse-query, gnus-search-query-return-string)
      (gnus-search-imap, gnus-search-imap-search-command)
      (gnus-search-transform-expression):
      * lisp/gnus/nnselect.el:
      * lisp/isearch.el (isearch-lazy-count-format):
      * lisp/mh-e/mh-show.el (mh-show-msg):
      * lisp/net/dictionary-connection.el (dictionary-connection-open):
      * lisp/net/dictionary.el (dictionary-default-popup-strategy)
      (dictionary, dictionary-split-string, dictionary-do-select-dictionary)
      (dictionary-display-dictionarys, dictionary-search)
      (dictionary-tooltip-mode):
      * lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
      * lisp/net/mailcap.el (mailcap-mime-data):
      * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
      * lisp/nxml/nxml-mode.el (nxml-mode):
      * lisp/progmodes/cc-engine.el:
      * lisp/progmodes/cperl-mode.el (cperl-mode)
      (cperl-fontify-syntaxically):
      * lisp/progmodes/flymake.el (flymake-diagnostic-functions):
      * lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
      (verilog-preprocess):
      * lisp/simple.el (self-insert-uses-region-functions):
      * lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
      * lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
      * src/dispnew.c:
      * src/font.c (Ffont_get):
      * src/indent.c (compute_motion):
      * src/process.c (init_process_emacs):
      * src/w32fns.c (deliver_wm_chars):
      * test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
      Fix typos in documentation, comments, and internal identifiers.
      de15ca7d
  10. 17 Feb, 2021 1 commit
    • Michael Albinus's avatar
      Further Tramp code cleanup · e5f50f32
      Michael Albinus authored
      * doc/misc/tramp.texi (Predefined connection information):
      Mention "about-args".
      
      * lisp/net/tramp-cmds.el (tramp-version): Adapt docstring.
      
      * lisp/net/tramp.el (tramp-handle-expand-file-name):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name):
      * lisp/net/tramp-sh.el (tramp-sh-handle-expand-file-name)
      * lisp/net/tramp-smb.el (tramp-smb-handle-expand-file-name):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-expand-file-name):
      Handle local "/..".
      
      * lisp/net/tramp-rclone.el (tramp-methods) <rclone>:
      Adapt `tramp-mount-args'.
      (tramp-rclone-flush-directory-cache): Remove.
      (tramp-rclone-do-copy-or-rename-file)
      (tramp-rclone-handle-delete-directory)
      (tramp-rclone-handle-delete-file)
      (tramp-rclone-handle-make-directory): Don't use that function.
      (tramp-rclone-maybe-open-connection): Fix use of `tramp-mount-args'.
      
      * lisp/net/trampver.el (tramp-inside-emacs): New defun.
      * lisp/net/tramp.el (tramp-handle-make-process):
      * lisp/net/tramp-sh.el (tramp-sh-handle-make-process)
      (tramp-sh-handle-process-file, tramp-open-shell): Use it.
      (tramp-get-env-with-u-option): Remove.
      
      * test/lisp/net/tramp-tests.el (tramp-test05-expand-file-name-top):
      New test.
      e5f50f32
  11. 03 Feb, 2021 1 commit
    • Michael Albinus's avatar
      Tramp code cleanup · b81516c7
      Michael Albinus authored
      * lisp/net/tramp.el (tramp-signal-hook-function)
      (tramp-handle-access-file, tramp-handle-copy-directory)
      (tramp-handle-directory-files, tramp-handle-file-local-copy)
      (tramp-handle-insert-file-contents, tramp-handle-load):
      * lisp/net/tramp-adb.el (tramp-adb-handle-directory-files-and-attributes)
      (tramp-adb-handle-make-directory)
      (tramp-adb-handle-file-local-copy, tramp-adb-handle-copy-file)
      (tramp-adb-handle-rename-file):
      * lisp/net/tramp-crypt.el (tramp-crypt-do-copy-or-rename-file)
      (tramp-crypt-handle-directory-files)
      (tramp-crypt-handle-make-directory):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-error)
      (tramp-gvfs-do-copy-or-rename-file)
      (tramp-gvfs-handle-make-directory):
      * lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file)
      (tramp-rclone-handle-directory-files):
      * lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link)
      (tramp-sh-handle-directory-files-and-attributes)
      (tramp-sh-handle-file-name-all-completions)
      (tramp-sh-handle-copy-directory, tramp-do-copy-or-rename-file)
      (tramp-sh-handle-make-directory)
      (tramp-sh-handle-file-local-copy)
      (tramp-sh-inotifywait-process-filter):
      * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
      (tramp-smb-handle-copy-file, tramp-smb-handle-directory-files)
      (tramp-smb-handle-file-local-copy)
      (tramp-smb-handle-make-directory, tramp-smb-handle-rename-file):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file):
      Unify error report.
      
      * lisp/net/tramp-adb.el (tramp-adb-file-name-handler): Sync args
      with other `tramp-*-file-name-handler'.
      
      * lisp/net/tramp-compat.el (tramp-error): Declare.
      (tramp-compat-file-missing): New defsubst.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file):
      Handle volatile files.
      (tramp-gvfs-set-attribute): New defun.
      (tramp-gvfs-handle-set-file-modes)
      (tramp-gvfs-handle-set-file-times)
      (tramp-gvfs-handle-set-file-uid-gid): Use it.
      
      * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file):
      Use `msg-operation'.
      
      * lisp/net/tramp-smb.el (tramp-smb-handle-insert-directory):
      Remove superfluous `format:
      (tramp-smb-maybe-open-connection): Simplify loop.
      
      * lisp/net/tramp.el (tramp-handle-file-truename): Drop volume letter from
      symlinked files.
      
      * test/lisp/net/tramp-tests.el (tramp--test-gdrive-p): New defun.
      (tramp--test-nextcloud-p): Remove.
      (tramp-test40-special-characters-with-ls): Do not skip on MS Windows.
      (tramp-test41-utf8): Skip if needed.
      b81516c7
  12. 22 Jan, 2021 1 commit
    • Michael Albinus's avatar
      Use RemoteCommand option for Tramp's sshx and scpx methods · b2b26bd4
      Michael Albinus authored
      * doc/misc/tramp.texi (Inline methods) <sshx>:
      (External methods) <scpx>: Adapt call sequence.
      (Remote shell setup): Mention, that sshx and scpx overwrite
      RemoteCommand.
      (Remote processes): Restriction: direct asynchronous processes
      cannot be used when RemoteCommand is in use.
      `tramp-remote-process-environment' is not ignored any longer.
      
      * lisp/net/tramp-sh.el (tramp-methods) <sshx, scpx>: Handle login
      shell via RemoteCommand.  Remove `tramp-direct-async' parameter.
      (tramp-maybe-open-connection): Add "-i" to login.
      
      * lisp/net/tramp-smb.el (tramp-smb-errors):
      Add "NT_STATUS_NOT_SUPPORTED".
      (tramp-smb-handle-insert-directory): Fix point moving error.
      
      * test/lisp/net/tramp-tests.el (tramp-test34-explicit-shell-file-name):
      Use `get-buffer-process' where appropriate.
      b2b26bd4
  13. 01 Jan, 2021 2 commits
  14. 07 Dec, 2020 1 commit
  15. 01 Dec, 2020 1 commit
    • Michael Albinus's avatar
      Allow Tramp to mirror traces to a file · ba692b79
      Michael Albinus authored
      * doc/misc/tramp.texi (Traces and Profiles): Add `tramp-debug-to-file'.
      
      * lisp/net/tramp-adb.el (tramp-adb-parse-device-names)
      (tramp-adb-get-device):
      * lisp/net/tramp-cmds.el (tramp-rename-files):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-monitor-process-filter)
      (tramp-gvfs-handler-volumeadded-volumeremoved)
      (tramp-get-media-devices):
      * lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch)
      (tramp-sh-gio-monitor-process-filter)
      (tramp-sh-gvfs-monitor-dir-process-filter)
      (tramp-sh-inotifywait-process-filter, tramp-maybe-send-script)
      (tramp-find-inline-encoding):
      * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
      (tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
      Use `tramp-compat-string-replace'.
      
      * lisp/net/tramp-compat.el (tramp-compat-string-replace): New defalias.
      
      * lisp/net/tramp.el (tramp-debug-to-file): New defcustom.
      (tramp-get-debug-buffer): Simplify.
      (tramp-get-debug-file-name): New defun.
      (tramp-debug-message): Write debug file if indicated.
      ba692b79
  16. 22 Nov, 2020 1 commit
    • Michael Albinus's avatar
      Replace /dev/null by remote null-device in Tramp. · 9b6ad310
      Michael Albinus authored
      * lisp/net/tramp-adb.el (tramp-adb-get-ls-command)
      (tramp-adb-handle-set-file-times, tramp-adb-handle-process-file):
      Use `tramp-get-remote-null-device'.
      
      * lisp/net/tramp-compat.el (tramp-tramp-file-p): Declare.
      (tramp-compat-null-device): New defalias.
      
      * lisp/net/tramp-sh.el (tramp-methods) <telnet, nc>:
      (tramp-perl-encode-with-module, tramp-perl-decode-with-module)
      (tramp-perl-encode, tramp-perl-decode, tramp-awk-decode):
      Use "%n" marker.
      (tramp-do-directory-files-and-attributes-with-stat)
      (tramp-sh-handle-file-name-all-completions)
      (tramp-do-copy-or-rename-file-out-of-band)
      (tramp-sh-handle-insert-directory, tramp-sh-handle-process-file)
      (tramp-set-remote-path, tramp-open-connection-setup-interactive-shell)
      (tramp-find-inline-encoding, tramp-send-command-and-check)
      (tramp-get-remote-path, tramp-get-ls-command, tramp-get-ls-command-with)
      (tramp-get-remote-awk, tramp-get-remote-hexdump, tramp-get-remote-od)
      (tramp-get-env-with-u-option): Use `tramp-get-remote-null-device'.
      (tramp-remote-coding-commands, tramp-call-local-coding-command):
      Adapt docstring.
      
      * lisp/net/tramp-smb.el (tramp-smb-conf): Use `null-device'.
      (tramp-smb-handle-file-acl): Use `tramp-get-remote-null-device'.
      
      * lisp/net/tramp.el (tramp-methods): Adapt docstring.
      (tramp-get-remote-null-device): New defun.
      (tramp-interrupt-process): Use it.
      9b6ad310
  17. 13 Nov, 2020 1 commit
    • Michael Albinus's avatar
      Some minor Tramp fixes, resulting from test campaign · 297f89f7
      Michael Albinus authored
      * lisp/net/tramp.el (tramp-handle-write-region):
      * lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
      * lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
      * lisp/net/tramp-smb.el (tramp-smb-handle-write-region): Use `current-time'
      if needed.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-gio-mapping):
      (tramp-gvfs-do-copy-or-rename-file): Remove "gvfs-rename", it is
      not trustworthy.
      
      * test/lisp/net/tramp-tests.el (tramp-test07-file-exists-p): Check also for
      symlinked files in trash.
      (tramp-test20-file-modes): Revert last change, it was a thinko.
      297f89f7
  18. 11 Nov, 2020 1 commit
    • Michael Albinus's avatar
      Some minor changes to Tramp, do not merge with master · 658952a5
      Michael Albinus authored
      * lisp/net/tramp.el (tramp-handle-directory-files)
      (tramp-handle-directory-files-and-attributes):
      * lisp/net/tramp-adb.el
      (tramp-adb-handle-directory-files-and-attributes):
      * lisp/net/tramp-rclone.el (tramp-rclone-handle-directory-files):
      * lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes):
      * lisp/net/tramp-smb.el (tramp-smb-handle-directory-files): Add _COUNT.
      Make the functions forward compatible.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-enabled):
      Increase `max-specpdl-size' temporarily.
      
      * test/lisp/net/tramp-tests.el (tramp--test-share-p): New defun.
      (tramp-test05-expand-file-name-relative): Use it.
      658952a5
  19. 05 Nov, 2020 1 commit
    • Michael Albinus's avatar
      Still fixes for Tramp directory-files-* · 334e2ab4
      Michael Albinus authored
      * lisp/net/tramp.el (tramp-handle-directory-files):
      * lisp/net/tramp-adb.el
      (tramp-adb-handle-directory-files-and-attributes): Fix COUNT.
      
      * lisp/net/tramp-crypt.el (tramp-crypt-handle-directory-files):
      Implement COUNT.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-byte-array-to-string):
      * lisp/net/tramp-integration.el (tramp-eshell-directory-change):
      Use `nbutlast'.
      
      * lisp/net/tramp-rclone.el (tramp-rclone-handle-delete-directory)
      (tramp-rclone-handle-delete-file): Reorder cache flushing.
      (tramp-rclone-handle-directory-files):
      Use `tramp-compat-directory-files'.
      
      * lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes):
      Fix NOSORT and COUNT.
      
      * lisp/net/tramp-smb.el (tramp-smb-handle-directory-files): Fix NOSORT.
      
      * test/lisp/net/tramp-tests.el (tramp--test-share-p): New defun.
      (tramp-test05-expand-file-name-relative): Use it.
      (tramp-test16-directory-files)
      (tramp-test19-directory-files-and-attributes): Strengthen test.
      (tramp-test20-file-modes): Simplify check.
      334e2ab4
  20. 04 Nov, 2020 1 commit
    • Stefan Monnier's avatar
      Fix misuses of `make-local-variable` on hooks · a63d9051
      Stefan Monnier authored
      * lisp/vc/smerge-mode.el (smerge-ediff):
      * lisp/progmodes/python.el (python-pdbtrack-setup-tracking):
      * lisp/net/tramp-smb.el (tramp-smb-call-winexe):
      * lisp/net/secrets.el (secrets-mode):
      * lisp/mail/rmail.el (rmail-variables):
      * lisp/ielm.el (inferior-emacs-lisp-mode):
      * lisp/erc/erc-log.el (erc-log-setup-logging): Use `add-hook`.
      
      * lisp/eshell/em-unix.el (eshell/diff):
      * lisp/eshell/em-hist.el (eshell-hist-initialize): Don't
      `make-local-variable` on hooks.
      a63d9051
  21. 02 Nov, 2020 2 commits
    • Michael Albinus's avatar
      Fix some glitches in recent directory-files-* changes · e654b41c
      Michael Albinus authored
      * doc/lispref/files.texi (Contents of Directories):
      Fix description of directory-files, directory-empty-p and
      directory-files-and-attributes.
      
      * etc/NEWS: Fix entry for directory-files-and-attributes.  Fix typos.
      
      * lisp/dired.el (directory-empty-p): Move function from here ...
      
      * lisp/files.el (directory-empty-p): ... to here.
      
      * lisp/net/ange-ftp.el (ange-ftp-directory-files): Call `nreverse' later.
      
      * lisp/net/tramp.el (tramp-handle-directory-files):
      * lisp/net/tramp-adb.el
      (tramp-adb-handle-directory-files-and-attributes): Do not call
      `nreverse'.
      
      * src/dired.c (Fdirectory_files)
      (Fdirectory_files_and_attributes): Fix docstrings.
      
      * test/src/dired-tests.el: Removed.  Tests moved to
      test/lisp/dired-tests.el.
      
      * test/lisp/dired-tests.el (dired-test-bug27899): Tag it :unstable.
      (dired-test-directory-files)
      (dired-test-directory-files-and-attributes): New tests.
      e654b41c
    • Arthur Miller's avatar
      Add directory-empty-p and new argument COUNT for directory-files-* · 08060755
      Arthur Miller authored
      * doc/lispref/files.texi (Contents of Directories): Mention COUNT
      argument of directory-files.  Add directory-empty-p.
      
      * etc/NEWS: Mention directory-empty-p and directory-files changes.
      
      * lisp/dired.el (directory-empty-p): New defun.
      
      * lisp/net/ange-ftp.el (ange-ftp-directory-files)
      (ange-ftp-directory-files-and-attributes):
      * lisp/net/tramp.el (tramp-handle-directory-files)
      (tramp-handle-directory-files-and-attributes):
      * lisp/net/tramp-adb.el
      (tramp-adb-handle-directory-files-and-attributes):
      * lisp/net/tramp-rclone.el (tramp-rclone-handle-directory-files):
      * lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes):
      * lisp/net/tramp-smb.el (tramp-smb-handle-directory-files): Add new COUNT
      argument.
      
      * src/dired.c (directory_files_internal): Implement new
      RETURN_COUNT argument.
      (Fdirectory_files, Fdirectory_files_and_attributes): Add new COUNT
      argument.
      
      * src/lisp.h (directory_files_internal): Add RETURN_COUNT to declaration.
      
      * src/sysdep.c (list_system_processes): Add Qnil to
      directory_files_internal call.
      
      * test/src/dired-tests.el (directory-files-and-attributes-tests):
      New file.
      08060755
  22. 01 Nov, 2020 1 commit
    • Michael Albinus's avatar
      Trash remote files to local trash (Bug#44216) · 06585bb9
      Michael Albinus authored
      * doc/misc/tramp.texi (Frequently Asked Questions): Add trashing.
      
      * lisp/net/tramp-adb.el (tramp-adb-handle-delete-directory)
      (tramp-adb-handle-delete-file):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-delete-directory)
      (tramp-gvfs-handle-delete-file):
      * lisp/net/tramp-sh.el (tramp-sh-handle-delete-directory)
      (tramp-sh-handle-delete-file):
      * lisp/net/tramp-smb.el (tramp-smb-handle-delete-directory)
      (tramp-smb-handle-delete-file):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-delete-directory)
      (tramp-sudoedit-handle-delete-file): Implement local trash.  (Bug#44216)
      
      * lisp/net/tramp-crypt.el (tramp-crypt-handle-delete-directory)
      (tramp-crypt-handle-delete-file): Do not trash.
      
      * lisp/net/tramp.el (tramp-skeleton-delete-directory): New defmacro.
      
      * test/lisp/net/tramp-tests.el (tramp-test07-file-exists-p)
      (tramp-test14-delete-directory): Add trashing.
      06585bb9
  23. 25 Aug, 2020 1 commit
    • Michael Albinus's avatar
      Sync with Tramp 2.4.5-pre · 4657f08b
      Michael Albinus authored
      * doc/misc/tramp.texi: Adapt Tramp and Emacs version numbers.
      (Remote processes): Describe `process-file-return-signal-string'
      and $INSIDE_EMACS.
      (Frequently Asked Questions): Mention Emacs 28.
      Describe `tramp-smb-options'.
      
      * doc/misc/trampver.texi: Change version to "2.4.5-pre".
      
      * lisp/net/tramp-adb.el (process-file-return-signal-string): Declare.
      (tramp-adb-handle-write-region): Flush the cache after the file
      has been written.
      (tramp-adb-handle-set-file-modes, tramp-adb-handle-set-file-times):
      Add optional _FLAG.
      (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file)
      (tramp-adb-handle-process-file): Use `tramp-file-local-name'.
      (tramp-adb-get-signal-strings): New defun.
      (tramp-adb-handle-process-file): Use it.
      (tramp-adb-handle-make-process): Implement `stderr'.  Use
      `insert-file-contents-literally'.
      (tramp-adb-send-command-and-check): Add optional argument
      EXIT-STATUS.
      (tramp-adb-handle-process-file): Use it.
      
      * lisp/net/tramp-archive.el (tramp-archive-file-name-handler):
      Increase `max-specpdl-size' temporarily.
      
      * lisp/net/tramp-cache.el (top):
      Use `insert-file-contents-literally'.
      
      * lisp/net/tramp-cmds.el (tramp-rename-files):
      Use `tramp-file-local-name'.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Prevent crash for
      older Emacsen.
      (top): Adapt `tramp-gvfs-unload-hook'.
      (tramp-gvfs-handle-file-system-info): Fix error.
      (tramp-gvfs-handle-set-file-modes, tramp-gvfs-handle-set-file-times):
      Add optional _FLAG.
      
      * lisp/net/tramp-rclone.el (tramp-rclone-flush-directory-cache):
      Fix a problem with older Emacsen.
      
      * lisp/net/tramp-sh.el (process-file-return-signal-string): Declare.
      (tramp-sh-extra-args): Add "-noediting" as bash arg.
      (tramp-hexdump-encode, tramp-hexdump-awk-encode)
      (tramp-od-encode, tramp-od-awk-encode): New defconst.
      (tramp-awk-encode, tramp-awk-decode): Adapt.
      (tramp-awk-coding-test): Remove.
      (tramp-remote-coding-commands): Add hexdump/awk encoding.  (Bug#35639)
      (tramp-find-inline-encoding): Adapt handling of awk, hexdump and od.
      (tramp-get-remote-busybox, tramp-get-remote-awk)
      (tramp-get-remote-hexdump, tramp-get-remote-od): New defuns.
      (tramp-sh-handle-make-symbolic-link):
      (tramp-do-copy-or-rename-file-directly)
      (tramp-sh-handle-process-file, tramp-set-remote-path)
      (tramp-find-inline-encoding, tramp-get-remote-touch):
      Use `tramp-file-local-name'.
      (tramp-do-file-attributes-with-stat): Simplify shell command.
      Suppress errors (interpret as nil).
      (tramp-sh-handle-set-file-modes, tramp-sh-handle-set-file-times):
      Add optional _FLAG.
      (tramp-sh-handle-make-process): Do not visit with
      `insert-file-contents'.  Delete tmp file only if exists.  Support
      `stderr' as file name.  Delete temporary stderr file.  Flush
      connection properties in time.
      (tramp-sh-get-signal-strings): New defun.
      (tramp-sh-handle-process-file): Use it.
      (tramp-sh-handle-write-region): Copy to temp file only if FILENAME
      exists.  (Bug#40156)
      (tramp-set-remote-path): Send the command in several chunks if it
      is too large.  (Bug#42538)
      (tramp-open-connection-setup-interactive-shell): Move up "set +o
      vi +o emacs" command.   (Bug#39399)
      (tramp-send-command-and-read): Suppress `signal-hook-function'
      when reading expression.
      (tramp-send-command-and-check): Add optional argument EXIT-STATUS.
      (tramp-sh-handle-process-file): Use it.  (Bug#41099)
      
      * lisp/net/tramp-smb.el (tramp-smb-conf): Fix docstring.
      (tramp-smb-options): New defcustom.
      (tramp-smb-handle-copy-directory, tramp-smb-handle-file-acl)
      (tramp-smb-handle-set-file-acl, tramp-smb-maybe-open-connection):
      Use it.
      (tramp-smb-errors): Add "NT_STATUS_INVALID_PARAMETER".
      (tramp-smb-handle-make-symbolic-link)
      (tramp-smb-handle-process-file): Use `tramp-file-local-name'.
      
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file):
      (tramp-sudoedit-handle-set-file-uid-gid):
      Use `tramp-unquote-file-local-name'.
      (tramp-sudoedit-handle-make-symbolic-link):
      Use `tramp-file-local-name'.
      (tramp-sudoedit-handle-file-system-info): Fix a scoping error.
      (tramp-sudoedit-handle-set-file-modes):
      (tramp-sudoedit-handle-set-file-times): Add optional _FLAG.
      
      * lisp/net/tramp.el: Bump version to 2.4.5-pre.
      (tramp-file-local-name, tramp-unquote-file-local-name): New defuns.
      (tramp-set-connection-local-variables-for-buffer)
      (tramp-equal-remote, tramp-handle-make-auto-save-file-name):
      Use `tramp-tramp-file-p'.
      (tramp-parse-file): Use `insert-file-contents-literally'.
      (tramp-handle-file-modes, tramp-handle-file-times):
      Add optional _FLAG.
      (tramp-handle-shell-command): Fix `window-start' in output buffer.
      (Bug#39171)
      Handle `shell-command-dont-erase-buffer'.  (Bug#39067)
      Reorganize error-buffer handling.  Set `default-directory'.
      (Bug#39253)
      (tramp-handle-shell-command, tramp-handle-start-file-process):
      Implement asynchronous `error-buffer'.
      (tramp-action-process-alive): Read pending output.
      (tramp-read-passwd): Use `tramp-compat-temporary-file-directory'.
      (Bug#39389, Bug#39489)
      (tramp-interrupt-process): Improve command.
      
      * lisp/net/trampver.el: Change version to "2.4.5-pre".
      (tramp-repository-branch, tramp-repository-version):
      Bind `debug-on-error' to nil.
      
      * test/lisp/net/tramp-tests.el (tramp-get-remote-gid)
      (process-file-return-signal-string)
      (shell-command-dont-erase-buffer): Declare.
      (tramp-test10-write-region, tramp-test28-process-file)
      (tramp-test29-start-file-process, tramp-test30-make-process)
      (tramp-test31-interrupt-process, tramp-test32-shell-command):
      Extend test.
      (tramp-test10-write-region, tramp-test21-file-links): Use function
      symbols.
      (tramp-test18-file-attributes): Check `file-ownership-preserved-p'
      only if possible.
      (tramp--test-async-shell-command): New defun.
      (tramp--test-shell-command-to-string-asynchronously): Use it.
      (tramp-test32-shell-command-dont-erase-buffer): New test.
      4657f08b
  24. 12 Jul, 2020 1 commit
    • Michael Albinus's avatar
      More Tramp code cleanup · 7ee32966
      Michael Albinus authored
      * lisp/net/tramp.el (tramp-process-actions):
      * lisp/net/tramp-adb.el (tramp-adb-handle-file-system-info)
      (tramp-adb-handle-set-file-times)
      (tramp-adb-maybe-open-connection):
      * lisp/net/tramp-cmds.el (tramp-rename-files, tramp-rename-these-files)
      (tramp-reporter-dump-variable):
      * lisp/net/tramp-sh.el (tramp-do-file-attributes-with-stat)
      (tramp-sh-handle-file-selinux-context)
      (tramp-do-directory-files-and-attributes-with-stat)
      (tramp-sh-handle-file-name-all-completions)
      (tramp-sh-handle-write-region)
      (tramp-sh-handle-file-notify-add-watch)
      (tramp-sh-gvfs-monitor-dir-process-filter)
      (tramp-sh-inotifywait-process-filter)
      (tramp-sh-handle-file-system-info, tramp-find-executable)
      (tramp-open-shell, tramp-find-shell):
      * lisp/net/tramp-smb.el (tramp-smb-do-file-attributes-with-stat)
      (tramp-smb-handle-file-system-info):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-selinux-context)
      (tramp-sudoedit-handle-file-system-info): Remove superfluous
      `eval-when-compile', `concat' creates the string during byte
      compilation.  Reported by Mattias Engdegård <mattiase@acm.org>.
      
      * lisp/net/tramp-adb.el (tramp-adb-prompt): Simplify.
      (tramp-adb-send-command):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-string-to-byte-array):
      Use `string-match-p'.
      
      * lisp/net/tramp-sh.el (tramp-sunos-unames): New defconst.
      (tramp-find-executable, tramp-find-shell, tramp-get-remote-stat): Use it.
      7ee32966
  25. 10 Jul, 2020 1 commit
    • Michael Albinus's avatar
      Tramp code cleanup · 7caf5706
      Michael Albinus authored
      * lisp/net/tramp.el (tramp-shell-prompt-pattern)
      (tramp-wrong-passwd-regexp, tramp-method-regexp-alist)
      (tramp-domain-regexp, tramp-host-regexp, tramp-ipv6-regexp)
      (tramp-port-regexp, tramp-debug-outline-regexp)
      (tramp-drop-volume-letter, tramp-parse-shostkeys)
      (tramp-handle-file-name-case-insensitive-p):
      * lisp/net/tramp-adb.el (tramp-adb-send-command-and-check):
      * lisp/net/tramp-ftp.el (tramp-ftp-enable-ange-ftp):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-monitor-process-filter):
      * lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
      (tramp-device-escape-sequence-regexp):
      * lisp/net/tramp-smb.el (tramp-smb-do-file-attributes-with-stat)
      (tramp-smb-handle-set-file-acl, tramp-smb-read-file-entry):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-selinux-context):
      Use character classes in regexp.
      
      * lisp/net/tramp-adb.el (tramp-adb-ls-date-year-regexp)
      (tramp-adb-ls-date-time-regexp): New defconst.
      (tramp-adb-ls-date-regexp, tramp-adb-ls-toolbox-regexp)
      (tramp-adb-sh-fix-ls-output): Use them.
      (tramp-adb-handle-set-file-times, tramp-adb-maybe-open-connection):
      Apply `eval-when-compile' on constant concat data.
      (tramp-do-parse-file-attributes-with-ls):
      Suppress `signal-hook-function'.
      (tramp-adb--gnu-switches-to-ash): Remove unused function.
      (tramp-adb-handle-set-file-modes): Qhote argument.
      (tramp-adb-maybe-open-connection): Set file property rather than flush.
      
      * lisp/net/tramp-cmds.el (tramp-rename-these-files):
      Apply `eval-when-compile' on constant concat data.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-file-attributes)
      (tramp-gvfs-file-attributes-with-gvfs-ls-regexp): Embed them in
      `eval-and-compile'.
      (tramp-gvfs-get-directory-attributes): Apply `eval-when-compile'
      on constant concat data.
      7caf5706
  26. 23 Jun, 2020 1 commit
    • Michael Albinus's avatar
      Fix problem in tramp-smb.el · 35e881c5
      Michael Albinus authored
      * lisp/net/tramp-smb.el (tramp-smb-handle-directory-files):
      Use `directory-file-name'.
      
      * test/lisp/net/tramp-tests.el (trace): Require it.
      (tramp--test-instrument-test-case): Print also function traces.
      (tramp--test-smb-p): New defun.
      (tramp-test03-file-name-method-rules)
      (tramp-test05-expand-file-name-relative)
      (tramp-test21-file-links, tramp--test-windows-nt-or-smb-p)
      (tramp--test-check-files): Use it.
      35e881c5
  27. 19 Jun, 2020 1 commit
    • Michael Albinus's avatar
      Fix various problems in Tramp · 3e7499c8
      Michael Albinus authored
      * lisp/net/tramp-compat.el (tramp-temp-name-prefix): Declare.
      (tramp-compat-make-temp-name):
      * lisp/net/tramp.el (tramp-make-tramp-temp-name): New defuns.
      
      * lisp/net/tramp.el (tramp-make-tramp-temp-file):
      * lisp/net/tramp-sh.el (tramp-find-inline-encoding)
      (tramp-maybe-open-connection, tramp-get-remote-touch)
      (tramp-get-remote-chmod-h):
      * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory): Use them.
      
      * lisp/net/tramp-sh.el (tramp-do-file-attributes-with-stat):
      Simplify shell command.  Suppress errors (interpret as nil).
      (tramp-sh-handle-make-process): Do not visit with
      `insert-file-contents'.  Delete tmp file only if exists.
      (tramp-send-command-and-read): Suppress `signal-hook-function'
      when reading expression.
      3e7499c8
  28. 14 Jun, 2020 1 commit
    • Michael Albinus's avatar
      Rearrange detecting remote uid and gid in Tramp · b3e7d046
      Michael Albinus authored
      * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
      * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
      * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
      * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
      Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'.
      
      * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
      Add `file-ownership-preserved-p'.
      (tramp-crypt-add-directory): Check, that NAME is not quoted.
      (tramp-crypt-handle-file-ownership-preserved-p): New defun.
      (tramp-crypt-handle-insert-directory): Fix docstring.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
      Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'.
      (tramp-gvfs-handle-file-readable-p): Call `tramp-get-remote-uid'.
      (tramp-gvfs-handle-get-remote-uid)
      (tramp-gvfs-handle-get-remote-gid): Rename from
      `tramp-gvfs-get-remote-{uid,gid}'.  Do not cache result.
      (tramp-gvfs-maybe-open-connection): No special handling for remote
      uid and gid.
      
      * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
      Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'.
      (tramp-sh-handle-get-remote-uid, tramp-sh-handle-get-remote-gid):
      Rename from `tramp-get-remote-{uid,gid}'.  Do not cache result.
      (tramp-sh-handle-file-ownership-preserved-p): Distinguish by GROUP
      when caching.
      
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
      Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'.
      (tramp-sudoedit-handle-get-remote-uid)
      (tramp-sudoedit-handle-get-remote-gid): Rename from
      `tramp-sudoedit-get-remote-{uid,gid}'.  Do not cache result.
      (tramp-sudoedit-handle-set-file-uid-gid)
      (tramp-sudoedit-handle-write-region): Call `tramp-get-remote-uid'
      and `tramp-get-remote-gid'.
      (tramp-sudoedit-maybe-open-connection): No special handling for
      remote uid and gid.
      
      * lisp/net/tramp.el (tramp-file-name-for-operation):
      Add `tramp-get-remote-gid' and 'tramp-get-remote-uid'.
      (tramp-handle-write-region, tramp-check-cached-permissions):
      Call `tramp-get-remote-uid' and `tramp-get-remote-gid'.
      (tramp-get-remote-uid, tramp-get-remote-gid): New defuns.
      (tramp-local-host-p): Simplify `tramp-get-remote-uid' call.
      
      * test/lisp/net/tramp-tests.el (tramp-test17-dired-with-wildcards)
      Skip if needed.
      b3e7d046
  29. 29 May, 2020 1 commit
  30. 22 Apr, 2020 1 commit
    • Michael Albinus's avatar
      Support old SMB1 protocol in Tramp · ab214143
      Michael Albinus authored
      * doc/misc/tramp.texi (Frequently Asked Questions):
      Describe `tramp-smb-options'.
      
      * lisp/net/tramp-smb.el (tramp-smb-conf): Fix docstring.
      (tramp-smb-options): New defcustom.
      (tramp-smb-handle-copy-directory, tramp-smb-handle-file-acl)
      (tramp-smb-handle-set-file-acl, tramp-smb-maybe-open-connection):
      Use it.
      ab214143
  31. 29 Mar, 2020 1 commit
    • Michael Albinus's avatar
      Improve Tramp cache for asynchronous processes · 76b3bd8c
      Michael Albinus authored
      * lisp/net/tramp-adb.el (tramp-adb-handle-exec-path)
      (tramp-adb-get-device):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-handler-askquestion):
      * lisp/net/tramp-sh.el (tramp-remote-selinux-p, tramp-remote-acl-p)
      (tramp-open-connection-setup-interactive-shell)
      (tramp-maybe-open-connection, tramp-get-remote-path)
      (tramp-get-inline-compress, tramp-get-inline-coding):
      * lisp/net/tramp-smb.el (tramp-smb-get-cifs-capabilities)
      (tramp-smb-get-stat-capability):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-remote-acl-p)
      (tramp-sudoedit-remote-selinux-p): Cache property in main process.
      
      * lisp/net/tramp-cache.el (tramp-cache-undefined): New defconst.
      (tramp-get-hash-table, tramp-connection-property-p): Use it.
      (tramp-set-connection-property, tramp-flush-connection-property)
      (tramp-flush-connection-properties): Add sanity checks.
      (tramp-get-file-property, tramp-set-file-property)
      (tramp-get-connection-property, tramp-set-connection-property)
      (tramp-dump-connection-properties): Adapt docstring.
      
      * lisp/net/tramp-cmds.el (tramp-cleanup-connection): Delete all
      processes.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-unmount):
      Use `tramp-cleanup-connection'.
      
      * lisp/net/tramp-sh.el (tramp-sh-handle-vc-registered):
      Use `bound-and-true-p'.
      
      * lisp/net/tramp.el (tramp-get-process): New defun.
      76b3bd8c
  32. 28 Mar, 2020 1 commit
    • Michael Albinus's avatar
      Tramp cache fixes · e6c6486e
      Michael Albinus authored
      * lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
      * lisp/net/tramp-smb.el (tramp-smb-handle-write-region): Flush the
      cache after the file has been written.
      e6c6486e
  33. 09 Mar, 2020 1 commit
    • Michael Albinus's avatar
      Finish implementation of set-file-times FLAG arg in Tramp · a1e2a684
      Michael Albinus authored
      * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
      Implement FLAG.
      (tramp-adb-handle-copy-file): Adapt `set-file-times' call.
      
      * lisp/net/tramp-compat.el (tramp-compat-set-file-times): New defalias.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-modes)
      (tramp-gvfs-handle-set-file-times, tramp-gvfs-set-file-uid-gid):
      Simplify `tramp-gvfs-url-file-name' call.
      
      * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times): Implement FLAG.
      (tramp-do-copy-or-rename-file-via-buffer)
      (tramp-do-copy-or-rename-file-out-of-band): Add optional argument
      OK-IF-ALREADY-EXISTS.  Adapt callees.
      (tramp-do-copy-or-rename-file-via-buffer)
      (tramp-do-copy-or-rename-file-directly)
      (tramp-do-copy-or-rename-file-out-of-band): Adapt `set-file-times' call.
      
      * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
      (tramp-smb-handle-copy-file): Adapt `set-file-times' call.
      
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file):
      Adapt `set-file-times' call.
      (tramp-sudoedit-handle-set-file-times): Implement FLAG.
      
      * test/lisp/net/tramp-tests.el (tramp-test22-file-times): Extend test.
      a1e2a684
  34. 07 Mar, 2020 1 commit
    • Paul Eggert's avatar
      Add ‘nofollow’ flag to set-file-times · 5d4cf1fe
      Paul Eggert authored
      This is a companion to the recent set-file-modes patch.
      It adds support for a ‘nofollow’ flag to set-file-times (Bug#39773).
      Like the set-file-modes patch, it needs work in the w32 port.
      * admin/merge-gnulib (GNULIB_MODULES): Add futimens, utimensat.
      Remove utimens.
      * doc/lispref/files.texi (Changing Files):
      * etc/NEWS: Mention the change.
      * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
      * lisp/files.el (copy-directory):
      * lisp/gnus/gnus-cloud.el (gnus-cloud-replace-file):
      * lisp/net/tramp-adb.el (tramp-adb-handle-copy-file):
      * lisp/net/tramp-smb.el (tramp-smb-handle-copy-file):
      * lisp/tar-mode.el (tar-copy):
      * test/lisp/filenotify-tests.el (file-notify-test03-events):
      * test/lisp/files-tests.el:
      (files-tests-file-name-non-special-set-file-times):
      * test/lisp/net/tramp-tests.el (tramp-test22-file-times):
      When setting file times, avoid following symbolic links
      when the file is not supposed to be a symbolic link.
      * lib/futimens.c, lib/utimensat.c, m4/futimens.m4, m4/utimensat.m4:
      New files, copied from Gnulib.
      * lisp/gnus/gnus-cloud.el (gnus-cloud-replace-file):
      When creating a file that is not supposed to exist already,
      use the excl flag to check this.
      * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
      * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-times):
      Accept an optional FLAG arg that is currently ignored,
      and add a FIXME comment for it.
      * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-times):
      * src/fileio.c (Fset_file_times):
      Support an optional FLAG arg.
      * src/fileio.c (Fcopy_file): Use futimens instead of set_file_times,
      as it’s simpler and is a POSIX API.
      * src/sysdep.c (set_file_times): Move from here ...
      * src/w32.c (set_file_times): ... to here, and make it static,
      since it is now used only in w32.c.  Presumably w32.c should also
      add support for futimens and utimensat (the POSIX APIs, which
      Emacs now uses) and it can remove fdutimens (the Gnulib API,
      which Emacs no longer uses).
      5d4cf1fe
  35. 26 Feb, 2020 1 commit
    • Michael Albinus's avatar
      Finish Tramp's implementation of 'nofollow · 2261f893
      Michael Albinus authored
      * lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy):
      Do not use 'nofollow.
      (tramp-adb-handle-set-file-modes):
      * lisp/net/tramp-smb.el (tramp-smb-handle-set-file-modes):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes):
      * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-modes):
      Handle FLAG properly.
      (tramp-get-remote-chmod-h): Adapt implementation.
      
      * test/lisp/net/tramp-tests.el (tramp-get-remote-chmod-h): Declare.
      (tramp--test-ignore-make-symbolic-link-error): Revert last change.
      (tramp-test20-file-modes): Adapt test.
      2261f893
  36. 25 Feb, 2020 1 commit
    • Michael Albinus's avatar
      Finish implementation of {set-}file-modes FLAG arg in Tramp · 64af3c94
      Michael Albinus authored
      * lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy): Do not use
      'nofollow for temporary files.  Use `tramp-compat-set-file-modes'.
      (tramp-adb-handle-write-region): Do not use 'nofollow for
      temporary files.
      (tramp-adb-handle-set-file-modes): Implement FLAG.
      
      * lisp/net/tramp-compat.el (tramp-compat-file-modes)
      (tramp-compat-set-file-modes): New defaliases.
      
      * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-modes):
      Make explicit check (eq flag 'nofollow).
      
      * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-modes): Implement FLAG.
      (tramp-do-copy-or-rename-file-directly)
      (tramp-sh-handle-file-local-copy, tramp-sh-handle-write-region):
      Do not use 'nofollow for temporary files.
      (tramp-get-remote-chmod-h): New defun.
      
      * lisp/net/tramp-smb.el (tramp-smb-handle-set-file-modes):
      Implement FLAG.
      
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes):
      Implement FLAG.
      (tramp-sudoedit-handle-write-region): Use `tramp-compat-set-file-modes'.
      
      * lisp/net/tramp.el (tramp-default-file-modes): Optional argument FLAG.
      (tramp-handle-file-modes): Use `file-truename' instead of
      `file-chase-links'.  The latter function does not work for remote
      file names.
      (tramp-handle-write-region): Call `tramp-default-file-modes' with
      'nofollow if needed.  Do not use 'nofollow for temporary files.
      
      * test/lisp/net/tramp-tests.el
      (tramp--test-ignore-make-symbolic-link-error): Check also for
      "Cannot chmod .* with nofollow flag" error.
      (tramp-test20-file-modes): Extend test.
      (tramp--test-emacs28-p): New defun.
      64af3c94
  37. 24 Feb, 2020 1 commit
    • Paul Eggert's avatar
      Add 'nofollow' flag to set-file-modes etc. · 9d626dff
      Paul Eggert authored
      This avoids some race conditions (Bug#39683).  E.g., if some other
      program changes a file to a symlink between the time Emacs creates
      the file and the time it changes the file’s permissions, using the
      new flag prevents Emacs from inadvertently changing the
      permissions of a victim in some completely unrelated directory.
      * admin/merge-gnulib (GNULIB_MODULES): Add fchmodat.
      * doc/lispref/files.texi (Testing Accessibility, Changing Files):
      * doc/lispref/os.texi (File Notifications):
      * etc/NEWS:
      Adjust documentation accordingly.
      * lib/chmodat.c, lib/fchmodat.c, lib/lchmod.c, m4/fchmodat.m4:
      * m4/lchmod.m4: New files, copied from Gnulib.
      * lib/gnulib.mk.in: Regenerate.
      * lisp/dired-aux.el (dired-do-chmod):
      * lisp/doc-view.el (doc-view-make-safe-dir):
      * lisp/emacs-lisp/autoload.el (autoload--save-buffer):
      * lisp/emacs-lisp/bytecomp.el (byte-compile-file):
      * lisp/eshell/em-pred.el (eshell-pred-file-mode):
      * lisp/files.el (backup-buffer-copy, copy-directory):
      * lisp/gnus/mail-source.el (mail-source-movemail):
      * lisp/gnus/mm-decode.el (mm-display-external):
      * lisp/gnus/nnmail.el (nnmail-write-region):
      * lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy)
      (tramp-adb-handle-write-region):
      * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-write-region):
      * lisp/net/tramp.el (tramp-handle-write-region)
      (tramp-make-tramp-temp-file):
      * lisp/server.el (server-ensure-safe-dir):
      * lisp/url/url-util.el (url-make-private-file):
      When getting or setting file modes, avoid following symbolic links
      when the file is not supposed to be a symbolic link.
      * lisp/doc-view.el (doc-view-make-safe-dir):
      Omit no-longer-needed separate symlink test.
      * lisp/gnus/gnus-util.el (gnus-set-file-modes):
      * lisp/net/tramp.el (tramp-handle-file-modes):
      * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-modes):
      * src/fileio.c (symlink_nofollow_flag): New function.
      (Ffile_modes, Fset_file_modes):
      Support an optional FLAG arg.  All C callers changed.
      * lisp/net/ange-ftp.el (ange-ftp-set-file-modes):
      * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-modes):
      * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-modes):
      * lisp/net/tramp-smb.el (tramp-smb-handle-set-file-modes):
      * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes):
      Accept an optional FLAG arg that is currently ignored,
      and add a FIXME comment for it.
      * m4/gnulib-comp.m4: Regenerate.
      9d626dff