Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add way to suppress built-in packages #236

Open
raxod502 opened this issue Feb 16, 2018 · 30 comments
Open

Add way to suppress built-in packages #236

raxod502 opened this issue Feb 16, 2018 · 30 comments

Comments

@raxod502
Copy link
Member

Accidentally having the built-in version of Org loaded before the straight.el version is made available is a recurring problem. This should be solvable by introducing a new user-facing function that takes a feature name and adds advice in order to signal an error if the feature is loaded from anywhere except a package installed by straight.el.

@raxod502 raxod502 added this to the 1.0 milestone Feb 16, 2018
@raxod502 raxod502 removed this from the 1.0 milestone Mar 30, 2018
raxod502 added a commit to radian-software/radian that referenced this issue May 22, 2018
@david-greene-cb
Copy link

I am having this issue with TRAMP. I load TRAMP like this:

(use-package tramp
  :straight t
  :demand t
  :config
  ;;(setq tramp-verbose 6)
  (setq tramp-default-method "ssh")

  (setq vc-ignore-dir-regexp
        (format "\\(%s\\)\\|\\(%s\\)"
	        vc-ignore-dir-regexp
	        tramp-file-name-regexp))

  ;; Honor remote PATH.
  (add-to-list 'tramp-remote-path 'tramp-own-remote-path)

  ;; Allow ssh connections to persist.
  ;;
  ;; This seems to maybe cause tramp to hang a lot.
  (customize-set-variable 'tramp-use-ssh-controlmaster-options nil)

  (if (eq window-system 'w32)
                                        ;(setq tramp-default-method "ssh")
      (setq tramp-default-method "scp")
                                        ;(setq tramp-default-method "scpx")
    (setq tramp-default-method "ssh"))
  )

(autoload #'tramp-register-crypt-file-name-handler "tramp-crypt")
(require 'tramp)

However tramp-version reports the version of the built-in TRAMP, not the one straight cloned.

@david-greene-cb
Copy link

Hmm, actually it seems none of config: ran at all, as if the package was never loaded.

@progfolio
Copy link
Contributor

progfolio commented Apr 23, 2021

Hi, David. Can you please try evaluating the following test case in a buffer with lexical binding enabled?:

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (straight-use-package 'tramp)
  (require 'tramp)
  (message "%S"
           (tramp-version nil)))
  • Test run at: 2021-04-23 18:50:39
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> develop, origin/develop) 4a473e5 2021-04-08
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-04-21
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 3306647 2021-04-18
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.5.1-pre
"2.5.1-pre"
Packages:
"org-elpa"                n/a                  n/a
"melpa"                   n/a                  master d4ababc7 2021-04-20
"gnu-elpa-mirror"         n/a                  master 3e7e586 2021-04-17
"el-get"                  melpa                master 84dd1837 2021-02-07
"emacsmirror-mirror"      n/a                  master 1c24bce 2021-04-08
"straight"                n/a                  develop 3306647 2021-04-18
"tramp"                   gnu-elpa-mirror      master 6f69a0b 2021-03-30

It will install straight.el and tramp in a clean testing environment. When it is done running, a results buffer should pop up and you can copy the results here. Thanks.

@david-greene-cb
Copy link

Here's what I get:

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (straight-use-package 'tramp)
  (require 'tramp)
  (message "%S"
           (tramp-version nil)))
  • Test run at: 2021-04-23 18:05:45
  • system-type: darwin
  • straight-version: prerelease (HEAD -> master, origin/master, origin/HEAD) e1390a9 %cs
  • emacs-version: GNU Emacs 27.2 (build 1, aarch64-apple-darwin20.2.0, NS appkit-2022.20 Version 11.1 (Build 20C69)) of 2021-04-01
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 3306647 %cs
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

Debugger entered--Lisp error: (void-function tramp-register-crypt-file-name-handler)
  tramp-register-crypt-file-name-handler()
  tramp-register-file-name-handlers()
  #f(compiled-function () #<bytecode 0x4c68fae5>)()
  run-hooks(tramp--startup-hook)
  byte-code("\301\302!\210\303\300!\210\304\211\20\207" [tramp--startup-hook provide tramp run-hooks nil] 3)
  require(tramp)
  (let ((straight-bug-report-args '(:post-bootstrap (progn (straight-use-package 'tramp) (require 'tramp) (message "%S" (tramp-version nil))) :user-dir "/var/folders/8f/w80247hn2fd84p4sf0jmzj3m0000gn/T/t..." :executable "/opt/homebrew/Cellar/emacs-plus@27/27.2/Emacs.app/..."))) (setq user-emacs-directory "/var/folders/8f/w80247hn2fd84p4sf0jmzj3m0000gn/T/t...") (setq straight-repository-branch "develop") (setq debug-on-error t) (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously (concat "https://raw.githubusercontent.com/" "raxod502/straight.el/develop/install.el") 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (condition-case nil (message "Test run with version: %s" (straight-version)) (error nil)) (straight-use-package 'tramp) (require 'tramp) (message "%S" (tramp-version nil)))
  eval((let ((straight-bug-report-args '(:post-bootstrap (progn (straight-use-package ...) (require ...) (message "%S" ...)) :user-dir "/var/folders/8f/w80247hn2fd84p4sf0jmzj3m0000gn/T/t..." :executable "/opt/homebrew/Cellar/emacs-plus@27/27.2/Emacs.app/..."))) (setq user-emacs-directory "/var/folders/8f/w80247hn2fd84p4sf0jmzj3m0000gn/T/t...") (setq straight-repository-branch "develop") (setq debug-on-error t) (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously (concat "https://raw.githubusercontent.com/" "raxod502/straight.el/develop/install.el") 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (condition-case nil (message "Test run with version: %s" (straight-version)) (error nil)) (straight-use-package 'tramp) (require 'tramp) (message "%S" (tramp-version nil))) t)
  command-line-1(("--eval" "(let\n    ((straight-bug-report-args\n      '(:post-..."))
  command-line()
  normal-top-level()

@david-greene-cb
Copy link

@progfolio
Copy link
Contributor

I see, can you try a slightly modified version of the test case which incorporates the workaround in that thread?:

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (straight-use-package 'tramp)
  (autoload #'tramp-register-crypt-file-name-handler "tramp-crypt")
  (require 'tramp)
  (tramp-version nil))
  • Test run at: 2021-04-23 19:19:09
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> fix/clone-depth-docstring, fork/fix/clone-depth-docstring) 33aa10e 2021-04-23
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-04-21
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 3306647 2021-04-18
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.5.1-pre
Packages:
"org-elpa"                n/a                  n/a
"melpa"                   n/a                  master d4ababc7 2021-04-20
"gnu-elpa-mirror"         n/a                  master 3e7e586 2021-04-17
"el-get"                  melpa                master 84dd1837 2021-02-07
"emacsmirror-mirror"      n/a                  master 1c24bce 2021-04-08
"straight"                n/a                  develop 3306647 2021-04-18
"tramp"                   gnu-elpa-mirror      master 6f69a0b 2021-03-30

@david-greene-cb
Copy link

Here ya go. Wrong TRAMP version.

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (straight-use-package 'tramp)
  (autoload #'tramp-register-crypt-file-name-handler "tramp-crypt")
  (require 'tramp)
  (tramp-version nil))
  • Test run at: 2021-04-23 18:21:08
  • system-type: darwin
  • straight-version: prerelease (HEAD -> master, origin/master, origin/HEAD) e1390a9 %cs
  • emacs-version: GNU Emacs 27.2 (build 1, aarch64-apple-darwin20.2.0, NS appkit-2022.20 Version 11.1 (Build 20C69)) of 2021-04-01
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 3306647 %cs
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.4.5.27.2

@progfolio
Copy link
Contributor

progfolio commented Apr 23, 2021

Interesting. Could you try this test case as well?:

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (defun tramp-register-crypt-file-name-handler
      (&rest _args)
    nil)
  (straight-use-package 'tramp)
  (require 'tramp)
  (tramp-version nil))
  • Test run at: 2021-04-23 19:42:16
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> fix/clone-depth-docstring, fork/fix/clone-depth-docstring) 33aa10e 2021-04-23
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-04-21
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 3306647 2021-04-18
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.5.1-pre
Packages:
"org-elpa"                n/a                  n/a
"melpa"                   n/a                  master d4ababc7 2021-04-20
"gnu-elpa-mirror"         n/a                  master 3e7e586 2021-04-17
"el-get"                  melpa                master 84dd1837 2021-02-07
"emacsmirror-mirror"      n/a                  master 1c24bce 2021-04-08
"straight"                n/a                  develop 3306647 2021-04-18
"tramp"                   gnu-elpa-mirror      master 6f69a0b 2021-03-30

@david-greene-cb
Copy link

No go:

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (straight-use-package 'tramp)
  (defun tramp-register-crypt-file-name-handler
      (&rest _args)
    nil)
  (require 'tramp)
  (tramp-version nil))
  • Test run at: 2021-04-23 18:42:25
  • system-type: darwin
  • straight-version: prerelease (HEAD -> master, origin/master, origin/HEAD) e1390a9 %cs
  • emacs-version: GNU Emacs 27.2 (build 1, aarch64-apple-darwin20.2.0, NS appkit-2022.20 Version 11.1 (Build 20C69)) of 2021-04-01
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 3306647 %cs
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.4.5.27.2

@progfolio
Copy link
Contributor

My apologies, I edited the test case. The defun should go before the call to straight-use-package like so:

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (defun tramp-register-crypt-file-name-handler
      (&rest _args)
    nil)
  (straight-use-package 'tramp)
  (require 'tramp)
  (tramp-version nil))
  • Test run at: 2021-04-23 19:42:16
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> fix/clone-depth-docstring, fork/fix/clone-depth-docstring) 33aa10e 2021-04-23
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-04-21
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 3306647 2021-04-18
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.5.1-pre
Packages:
"org-elpa"                n/a                  n/a
"melpa"                   n/a                  master d4ababc7 2021-04-20
"gnu-elpa-mirror"         n/a                  master 3e7e586 2021-04-17
"el-get"                  melpa                master 84dd1837 2021-02-07
"emacsmirror-mirror"      n/a                  master 1c24bce 2021-04-08
"straight"                n/a                  develop 3306647 2021-04-18
"tramp"                   gnu-elpa-mirror      master 6f69a0b 2021-03-30

@david-greene-cb
Copy link

Still no go:

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (defun tramp-register-crypt-file-name-handler
      (&rest _args)
    nil)
  (straight-use-package 'tramp)
  (require 'tramp)
  (tramp-version nil))
  • Test run at: 2021-04-23 18:46:14
  • system-type: darwin
  • straight-version: prerelease (HEAD -> master, origin/master, origin/HEAD) e1390a9 %cs
  • emacs-version: GNU Emacs 27.2 (build 1, aarch64-apple-darwin20.2.0, NS appkit-2022.20 Version 11.1 (Build 20C69)) of 2021-04-01
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 3306647 %cs
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.4.5.27.2

@progfolio
Copy link
Contributor

There are a few things that could be happening here. Let's make sure we're actually getting the correct commit in the repo first. This test case should take care of that:

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (straight-use-package 'tramp)
  (let
      ((default-directory
         (straight--repos-dir "tramp")))
    (message "%S"
             (straight--process-output "git" "log" "HEAD^..HEAD"))))
  • Test run at: 2021-04-23 20:03:32
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> fix/clone-depth-docstring, fork/fix/clone-depth-docstring) 33aa10e 2021-04-23
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-04-21
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 3306647 2021-04-18
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

"commit 6f69a0ba117f78265279dd418fa0bc042989f8d5
Author: GNU ELPA Mirror Bot <emacs-devel@gnu.org>
Date:   Tue Mar 30 15:22:36 2021 +0000

    Update tramp
    
    Timestamp: 2021-03-30 15:18:41
    GNU ELPA commit: b2f8d97feb99aa9970f65b6d26d1904c1cb3c43e
    Emacs commit: 49cbf2392ba51c2ebd866b062dbf7908c595466f"
Packages:
"org-elpa"                n/a                  n/a
"melpa"                   n/a                  master d4ababc7 2021-04-20
"gnu-elpa-mirror"         n/a                  master 3e7e586 2021-04-17
"el-get"                  melpa                master 84dd1837 2021-02-07
"emacsmirror-mirror"      n/a                  master 1c24bce 2021-04-08
"straight"                n/a                  develop 3306647 2021-04-18
"tramp"                   gnu-elpa-mirror      master 6f69a0b 2021-03-30

@progfolio
Copy link
Contributor

You can also try inserting the following near the top of your init file to see when tramp is being loaded:

(eval-after-load "tramp" '(debug))

It should throw you into the debugger which will (hopefully) show when Tramp is being loaded.
Might need to launch emacs with --debug-init for it to work properly.

@david-greene-cb
Copy link

Here's the result of the new test:

Test Case
(straight-bug-report
  :user-dir "tramp-version.straight"
  :post-bootstrap 
  (straight-use-package 'tramp)
  (let
      ((default-directory
         (straight--repos-dir "tramp")))
    (message "%S"
             (straight--process-output "git" "log" "HEAD^..HEAD"))))
  • Test run at: 2021-04-23 19:17:05
  • system-type: darwin
  • straight-version: prerelease (HEAD -> master, origin/master, origin/HEAD) e1390a9 %cs
  • emacs-version: GNU Emacs 27.2 (build 1, aarch64-apple-darwin20.2.0, NS appkit-2022.20 Version 11.1 (Build 20C69)) of 2021-04-01
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) f790b05 %cs
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

"commit 6f69a0ba117f78265279dd418fa0bc042989f8d5
Author: GNU ELPA Mirror Bot <emacs-devel@gnu.org>
Date:   Tue Mar 30 15:22:36 2021 +0000

    Update tramp
    
    Timestamp: 2021-03-30 15:18:41
    GNU ELPA commit: b2f8d97feb99aa9970f65b6d26d1904c1cb3c43e
    Emacs commit: 49cbf2392ba51c2ebd866b062dbf7908c595466f"

@david-greene-cb
Copy link

With --debug-init I get a backtrace due to the tramp-crypt error. The autoload hack doesn't seem to get executed I think because :config is not executed. Perhaps :config isn't running due to the tramp-crypt error?

@progfolio
Copy link
Contributor

Ok, so we're cloning and building the correct version. It's just a matter of loading the correct version.

With --debug-init I get a backtrace due to the tramp-crypt error

Could you please copy that backtrace here?

The autoload hack doesn't seem to get executed I think because :config is not executed. Perhaps :config isn't running due to the tramp-crypt error?

The :config keyword's code is expanded after requiring the package in use-package. I would try moving that to :init in the use-package form.

@david-greene-cb
Copy link

Adding the autoload hack to :init seems to get it to load via straight but the version is still wrong.

@david-greene-cb
Copy link

Backtrace with debug on TRAMP load:

Debugger entered: nil
  (lambda nil (debug))()
  funcall((lambda nil (debug)))
  mapc(funcall ((lambda nil (debug))))
  do-after-load-evaluation("/Users/dag/.emacs.d/straight/build/tramp/tramp.elc")
  require(tramp nil t)
  (not (require 'tramp nil t))
  (if (not (require 'tramp nil t)) (display-warning 'use-package (format "Cannot load %s" 'tramp) :error) (condition-case err (progn (setq tramp-default-method "ssh") (setq tramp-shell-prompt-pattern "\\(?:^\\|\15\\)[^]#$%>\n]*#?[]#$%>].* *\\(^[\\[[0-9;]*[a-z...") (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" vc-ignore-dir-regexp tramp-file-name-regexp)) (if (member 'tramp-own-remote-path tramp-remote-path) tramp-remote-path (setq tramp-remote-path (cons 'tramp-own-remote-path tramp-remote-path))) (customize-set-variable 'tramp-use-ssh-controlmaster-options nil) (if (eq window-system 'w32) (setq tramp-default-method "scp") (setq tramp-default-method "ssh")) t) ((debug error) (funcall use-package--warning0 :config err))))
  (progn (condition-case err (autoload #'tramp-register-crypt-file-name-handler "tramp-crypt") ((debug error) (funcall use-package--warning0 :init err))) (if (not (require 'tramp nil t)) (display-warning 'use-package (format "Cannot load %s" 'tramp) :error) (condition-case err (progn (setq tramp-default-method "ssh") (setq tramp-shell-prompt-pattern "\\(?:^\\|\15\\)[^]#$%>\n]*#?[]#$%>].* *\\(^[\\[[0-9;]*[a-z...") (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" vc-ignore-dir-regexp tramp-file-name-regexp)) (if (member 'tramp-own-remote-path tramp-remote-path) tramp-remote-path (setq tramp-remote-path (cons 'tramp-own-remote-path tramp-remote-path))) (customize-set-variable 'tramp-use-ssh-controlmaster-options nil) (if (eq window-system 'w32) (setq tramp-default-method "scp") (setq tramp-default-method "ssh")) t) ((debug error) (funcall use-package--warning0 :config err)))))
  (condition-case err (progn (condition-case err (autoload #'tramp-register-crypt-file-name-handler "tramp-crypt") ((debug error) (funcall use-package--warning0 :init err))) (if (not (require 'tramp nil t)) (display-warning 'use-package (format "Cannot load %s" 'tramp) :error) (condition-case err (progn (setq tramp-default-method "ssh") (setq tramp-shell-prompt-pattern "\\(?:^\\|\15\\)[^]#$%>\n]*#?[]#$%>].* *\\(^[\\[[0-9;]*[a-z...") (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" vc-ignore-dir-regexp tramp-file-name-regexp)) (if (member 'tramp-own-remote-path tramp-remote-path) tramp-remote-path (setq tramp-remote-path (cons ... tramp-remote-path))) (customize-set-variable 'tramp-use-ssh-controlmaster-options nil) (if (eq window-system 'w32) (setq tramp-default-method "scp") (setq tramp-default-method "ssh")) t) ((debug error) (funcall use-package--warning0 :config err))))) ((debug error) (funcall use-package--warning0 :catch err)))
  eval-buffer(#<buffer  *load*-465418> nil "/Users/dag/lib/dotfiles/emacs/lisp/packages.el" nil t)  ; Reading at buffer position 3058
  load-with-code-conversion("/Users/dag/lib/dotfiles/emacs/lisp/packages.el" "/Users/dag/lib/dotfiles/emacs/lisp/packages.el" nil nil)
  load("packages")
  load-library("packages")
  eval-buffer(#<buffer  *load*> nil "/Users/dag/.emacs.d/init.el" nil t)  ; Reading at buffer position 3181
  load-with-code-conversion("/Users/dag/.emacs.d/init.el" "/Users/dag/.emacs.d/init.el" t t)
  load("/Users/dag/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x474bd347>) #f(compiled-function () #<bytecode 0x474bd35d>) t)
  command-line()
  normal-top-level()

It sure looks like it's loading from the straight repository...

@progfolio
Copy link
Contributor

Well I think I've found the problem.
The tramp-version function inserts the defconst tramp-version which according to trampver.el:

;; In the Tramp GIT repository, the version number, the bug report
;; address and the required Emacs version are auto-frobbed from
;; configure.ac, so you should edit that file and run "autoconf &&
;; ./configure" to change them.

@progfolio
Copy link
Contributor

So perhaps you have the most recent version loaded, but that defconst is incorrect?

@david-greene-cb
Copy link

I don't think that's it:

tramp-version is a variable defined in ‘tramp-cmds.el’.
Its value is "2.4.5.27.2"

  This variable may be risky if used as a file-local variable.

Documentation:
This version of Tramp.

[back]

In the straight repo the defconst is in trampver.el.

Hmm...It seems like apropos returns the function tramp-version regardless of whether I select the "Function" or "Variable."

But in any case, the linked tramp-cmds.el is from the system emacs installation.

@progfolio
Copy link
Contributor

Let's try this test case:

Test Case
(straight-bug-report
  :user-dir "tramp-test.straight"
  :post-bootstrap 
  (straight-use-package
   '(tramp :type git :repo "https://git.savannah.gnu.org/git/tramp.git" :host nil :pre-build
           (("autoconf")
            ("./configure")
            ("make"))))
  (require 'tramp)
  (tramp-version nil))
  • Test run at: 2021-04-23 20:58:55
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> fix/clone-depth-docstring, fork/fix/clone-depth-docstring) 33aa10e 2021-04-23
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-04-21
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) f790b05 2021-04-23
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.5.1-pre
Packages:
"org-elpa"                n/a                  n/a
"melpa"                   n/a                  master d4ababc7 2021-04-20
"gnu-elpa-mirror"         n/a                  master 3e7e586 2021-04-17
"el-get"                  melpa                master 84dd1837 2021-02-07
"emacsmirror-mirror"      n/a                  master 1c24bce 2021-04-08
"straight"                n/a                  develop f790b05 2021-04-23
"tramp"                   gnu-elpa-mirror      master 5a992d7b 2021-04-23

@david-greene-cb
Copy link

No dice.

Test Case
(straight-bug-report
  :user-dir "tramp-test.straight"
  :post-bootstrap 
  (straight-use-package
   '(tramp :type git :repo "https://git.savannah.gnu.org/git/tramp.git" :host nil :pre-build
           (("autoconf")
            ("./configure")
            ("make"))))
  (require 'tramp)
  (tramp-version nil))
  • Test run at: 2021-04-23 23:35:39
  • system-type: darwin
  • straight-version: prerelease (HEAD -> master, origin/master, origin/HEAD) e1390a9 %cs
  • emacs-version: GNU Emacs 27.2 (build 1, aarch64-apple-darwin20.2.0, NS appkit-2022.20 Version 11.1 (Build 20C69)) of 2021-04-01
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) f790b05 %cs
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.4.5.27.2

@david-greene-cb
Copy link

So I tried your latest testcase in my init.el and it at least eliminates the need for the autoload hack:

(use-package tramp
  :straight (tramp :type git
                   :repo "https://git.savannah.gnu.org/git/tramp.git"
                   :host nil
                   :pre-build
                   (("autoconf")
                    ("./configure")
                    ("make")))
  :demand t
;  :init
;  (autoload #'tramp-register-crypt-file-name-handler "tramp-crypt")
  :config
  ;;(setq tramp-verbose 6)
  (setq tramp-default-method "ssh")
  (setq tramp-shell-prompt-pattern "\\(?:^\\|\r\\)[^]#$%>\n]*#?[]#$%>].* *\\(^[\\[[0-9;]*[a-zA-Z] *\\)*")

  (setq vc-ignore-dir-regexp
        (format "\\(%s\\)\\|\\(%s\\)"
	        vc-ignore-dir-regexp
	        tramp-file-name-regexp))

  ;; Honor remote PATH.
  (add-to-list 'tramp-remote-path 'tramp-own-remote-path)

  ;; Allow ssh connections to persist.
  ;;
  ;; This seems to maybe cause tramp to hang a lot.
  (customize-set-variable 'tramp-use-ssh-controlmaster-options nil)
  ;; (customize-set-variable 'tramp-use-ssh-controlmaster-options t)

  (if (eq window-system 'w32)
                                        ;(setq tramp-default-method "ssh")
      (setq tramp-default-method "scp")
                                        ;(setq tramp-default-method "scpx")
    (setq tramp-default-method "ssh"))

  ;;(setq tramp-default-method "ssh")
  ;;(tramp-change-syntax 'simplified)
  ;;(setq tramp-verbose 10)
  )

However, the wrong version is still reported by tramp-version.

@progfolio
Copy link
Contributor

progfolio commented Apr 27, 2021

If you M-x find-library trampver, what is the output of M-x pwd?

@david-greene-cb
Copy link

/opt/homebrew/Cellar/emacs-plus@28/28.0.50/share/emacs/28.0.50/lisp/net/

So it is picking up the built-in TRAMP.

@progfolio
Copy link
Contributor

Can we see the value of the load-path variable? Might also be valuable to see the output of M-x list-load-path-shadows.

@progfolio
Copy link
Contributor

If you have your init uploaded somewhere I can take a look to see if something is pulling in tramp before straight installs it, too.

@toshokan
Copy link

@raxod502

I ran into this today and did some investigation.
On my machine, tramp-version was also in the 2.4.x range despite installing tramp with straight.el
Interestingly, M-x find-library tramp brought me into the straight.el-managed checkout of tramp, not the built-in one.

I thought it might be a shadowing issue, so I removed the built-in tramp-*.el files from the load path to see if it would load the straight.el-managed version that way, but instead I found that tramp wouldn't load at all because of a (require 'tramp-loaddefs)

It seems the autoloads generated as part of the build are not sufficient for loading tramp, which causes emacs to keep searching further down the load path until it finds the built-in tramp autoloads and then loads the (wrong) tramp-*.el files adjacent to the autoloads.

The checked-out tramp Makefile was reminiscent of Org's, with a make target to build the autoloads file. If I change the recipe to the following, everything works fine:

Test Case
(straight-bug-report
  :user-dir "tramp-test.straight"
  :post-bootstrap 
  (straight-use-package
   '(tramp :build t :pre-build
	   (("make" "autoloads"))))
  (require 'tramp)
  (tramp-version nil))
  • Test run at: 2021-07-25 22:13:01
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> master, origin/master, origin/HEAD) 1e27b05 2021-06-13
  • emacs-version: GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.29) of 2021-07-24
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 08b0ecf 2021-07-24
Cloning tramp...
Cloning tramp...done
Building tramp...
Building tramp...done

2.5.1
Packages:
"org-elpa"                n/a                  n/a
"melpa"                   n/a                  master f0f88655 2021-07-25
"gnu-elpa-mirror"         n/a                  master 0ed8c5a 2021-07-17
"el-get"                  melpa                master 463f5e98 2021-07-06
"emacsmirror-mirror"      n/a                  master b0d7728 2021-07-26
"straight"                n/a                  develop 08b0ecf 2021-07-24
"tramp"                   gnu-elpa-mirror      master 8c183a5 2021-06-30

Of course, this won't work on Windows, since make won't be available, but let me know if you'd like me to put together a PR in the spirit of the Org recipe (with call-process on an emacs child process) to fix this issue for tramp

toshokan added a commit to toshokan/dotfiles that referenced this issue Jul 26, 2021
Have to specify a :pre-build, see radian-software/straight.el#236
@david-greene-cb
Copy link

david-greene-cb commented Aug 20, 2021

@toshokan I haven't been able to look at this due to work but thank you for the great analysis! I'd love a commit to fix this in straight.el but your workaround is very helpful. If nothing else we could add the workaround to the README.

RomanHargrave added a commit to RomanHargrave/emacs.d that referenced this issue Oct 4, 2021
Straight was not setting up tramp in a fashion that emacs would
load it, meaning that emacs would fall back to the system tramp.

See radian-software/straight.el#236 for specifics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants