Skip to content
This repository

args-out-of-range from magit-status #311

Closed
dabrahams opened this Issue · 2 comments

2 participants

Dave Abrahams Jonas Bernoulli
Dave Abrahams

I recently increased magit-repo-dirs-depth from 1 to 3 and then `C-u M-x magit-status' gave me this backtrace. When I removed some directories (e.g. "/Users/dave/src/fossbot-top") from magit-repo-dirs so that any given repo would only be found in one of the listed directory trees, the error went away.

Debugger entered--Lisp error: (args-out-of-range "/Users/dave/src/fossbot-top/fossbot" 0 -1)
  substring("/Users/dave/src/fossbot-top/fossbot" 0 -36)
  (directory-file-name (substring entry 0 (- (length key))))
  (let ((dir (directory-file-name (substring entry 0 (- (length key)))))) (cons (concat (file-name-nondirectory dir) "/" key) entry))
  (lambda (entry) (let ((dir (directory-file-name (substring entry 0 (- (length key)))))) (cons (concat (file-name-nondirectory dir) "/" key) entry)))("/Users/dave/src/fossbot-top/fossbot")
  mapcar((lambda (entry) (let ((dir (directory-file-name (substring entry 0 (- (length key)))))) (cons (concat (file-name-nondirectory dir) "/" key) entry))) ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot"))
  (magit-remove-conflicts (mapcar (lambda (entry) (let ((dir (directory-file-name (substring entry 0 ...)))) (cons (concat (file-name-nondirectory dir) "/" key) entry))) value))
  (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let (...) (cons ... entry))) value)))) (setq result (append result sub)))
  (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let ... ...)) value)))) (setq result (append result sub))))
  (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub)))))("//Users/dave/src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot"))
  maphash((lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub))))) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("//Users/dave/src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot") ...)))
  (let ((dict (make-hash-table :test (quote equal))) (result nil)) (dolist (a alist) (puthash (car a) (cons (cdr a) (gethash (car a) dict)) dict)) (maphash (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts ...))) (setq result (append result sub))))) dict) result)
  magit-remove-conflicts((("//Users/dave/src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot") ("//Users/dave/src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot")))
  (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let (...) (cons ... entry))) value)))) (setq result (append result sub)))
  (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let ... ...)) value)))) (setq result (append result sub))))
  (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub)))))("/Users/dave/src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot"))
  maphash((lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub))))) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("/Users/dave/src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot") ...)))
  (let ((dict (make-hash-table :test (quote equal))) (result nil)) (dolist (a alist) (puthash (car a) (cons (cdr a) (gethash (car a) dict)) dict)) (maphash (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts ...))) (setq result (append result sub))))) dict) result)
  magit-remove-conflicts((("/Users/dave/src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot") ("/Users/dave/src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot")))
  (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let (...) (cons ... entry))) value)))) (setq result (append result sub)))
  (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let ... ...)) value)))) (setq result (append result sub))))
  (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub)))))("Users/dave/src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot"))
  maphash((lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub))))) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("Users/dave/src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot") ...)))
  (let ((dict (make-hash-table :test (quote equal))) (result nil)) (dolist (a alist) (puthash (car a) (cons (cdr a) (gethash (car a) dict)) dict)) (maphash (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts ...))) (setq result (append result sub))))) dict) result)
  magit-remove-conflicts((("Users/dave/src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot") ("Users/dave/src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot")))
  (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let (...) (cons ... entry))) value)))) (setq result (append result sub)))
  (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let ... ...)) value)))) (setq result (append result sub))))
  (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub)))))("dave/src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot"))
  maphash((lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub))))) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("dave/src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot") ...)))
  (let ((dict (make-hash-table :test (quote equal))) (result nil)) (dolist (a alist) (puthash (car a) (cons (cdr a) (gethash (car a) dict)) dict)) (maphash (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts ...))) (setq result (append result sub))))) dict) result)
  magit-remove-conflicts((("dave/src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot") ("dave/src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot")))
  (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let (...) (cons ... entry))) value)))) (setq result (append result sub)))
  (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let ... ...)) value)))) (setq result (append result sub))))
  (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub)))))("src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot"))
  maphash((lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub))))) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("src/fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot") ...)))
  (let ((dict (make-hash-table :test (quote equal))) (result nil)) (dolist (a alist) (puthash (car a) (cons (cdr a) (gethash (car a) dict)) dict)) (maphash (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts ...))) (setq result (append result sub))))) dict) result)
  magit-remove-conflicts((("src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot") ("src/fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot")))
  (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let (...) (cons ... entry))) value)))) (setq result (append result sub)))
  (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let ... ...)) value)))) (setq result (append result sub))))
  (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub)))))("fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot"))
  maphash((lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub))))) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("fossbot-top/fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot") ...)))
  (let ((dict (make-hash-table :test (quote equal))) (result nil)) (dolist (a alist) (puthash (car a) (cons (cdr a) (gethash (car a) dict)) dict)) (maphash (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts ...))) (setq result (append result sub))))) dict) result)
  magit-remove-conflicts((("fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot") ("fossbot-top/fossbot" . "/Users/dave/src/fossbot-top/fossbot")))
  (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let (...) (cons ... entry))) value)))) (setq result (append result sub)))
  (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda (entry) (let ... ...)) value)))) (setq result (append result sub))))
  (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub)))))("fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot"))
  maphash((lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts (mapcar (lambda ... ...) value)))) (setq result (append result sub))))) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("zorg" ("/Users/dave/src/zorg") "wp-theme2" ("/Users/dave/src/wp-theme2") "wp-theme" ("/Users/dave/src/wp-theme") "winexe.1" ("/Users/dave/src/winexe.1") "wiegleymacs" ("/Users/dave/src/wiegleymacs") "std-info" ("/Users/dave/src/std-info") "slides" ("/Users/dave/src/slides") "sift" ("/Users/dave/src/sift") "pyth-llvm" ("/Users/dave/src/pyth-llvm") "pyth-clang" ("/Users/dave/src/pyth-clang") "org-mode" ("/Users/dave/src/org-mode") "offlineimap" ("/Users/dave/src/offlineimap") "mplbook" ("/Users/dave/src/mplbook") "modularize" ("/Users/dave/src/modularize") "llvm-project" ("/Users/dave/src/llvm-project") "llvm" ("/Users/dave/src/llvm") "linkdups" ("/Users/dave/src/linkdups") "legacy-svn-archive" ("/Users/dave/src/legacy-svn-archive") "lazy_reload" ("/Users/dave/src/lazy_reload") "in3xes-buildbot" ("/Users/dave/src/in3xes-buildbot") "gitolite-admin" ("/Users/dave/src/gitolite-admin") "git-submodule-tools" ("/Users/dave/src/git-submodule-tools") "fossbot" ("/Users/dave/src/fossbot-top/fossbot" "/Users/dave/src/fossbot-top/fossbot") "emacs" ("/Users/dave/src/emacs") "elisp" ("/Users/dave/src/elisp") "elhome" ("/Users/dave/src/elhome") "el-get-dev" ("/Users/dave/src/el-get-dev") "el-get" ("/Users/dave/src/el-get") "dwamacs" ("/Users/dave/src/dwamacs") "redmine-boostpro" ("/Users/dave/src/corp/redmine-boostpro") "xxx-options" ("/Users/dave/src/corp/zzzz/xxx-options") "edg" ("/Users/dave/src/corp/edg") "cpp11" ("/Users/dave/src/corp/cpp11") "BestPractices" ("/Users/dave/src/corp/BestPractices") "clang" ("/Users/dave/src/clang") "buildbot" ("/Users/dave/src/buildbot") "boost-git-svn-mirror" ("/Users/dave/src/boost/boost-git-svn-mirror") "bbproto" ("/Users/dave/src/bbproto-top/bbproto") "bbotpriv" ("/Users/dave/src/bbotpriv-top/bbotpriv" "/Users/dave/src/bbotpriv-top/bbotpriv") "master" ("/Users/dave/src/bbot-remote/master") ...)))
  (let ((dict (make-hash-table :test (quote equal))) (result nil)) (dolist (a alist) (puthash (car a) (cons (cdr a) (gethash (car a) dict)) dict)) (maphash (lambda (key value) (if (= (length value) 1) (push (cons key (car value)) result) (let ((sub (magit-remove-conflicts ...))) (setq result (append result sub))))) dict) result)
  magit-remove-conflicts((("zorg" . "/Users/dave/src/zorg") ("wp-theme2" . "/Users/dave/src/wp-theme2") ("wp-theme" . "/Users/dave/src/wp-theme") ("winexe.1" . "/Users/dave/src/winexe.1") ("wiegleymacs" . "/Users/dave/src/wiegleymacs") ("std-info" . "/Users/dave/src/std-info") ("slides" . "/Users/dave/src/slides") ("sift" . "/Users/dave/src/sift") ("pyth-llvm" . "/Users/dave/src/pyth-llvm") ("pyth-clang" . "/Users/dave/src/pyth-clang") ("org-mode" . "/Users/dave/src/org-mode") ("offlineimap" . "/Users/dave/src/offlineimap") ("mplbook" . "/Users/dave/src/mplbook") ("modularize" . "/Users/dave/src/modularize") ("llvm-project" . "/Users/dave/src/llvm-project") ("llvm" . "/Users/dave/src/llvm") ("linkdups" . "/Users/dave/src/linkdups") ("legacy-svn-archive" . "/Users/dave/src/legacy-svn-archive") ("lazy_reload" . "/Users/dave/src/lazy_reload") ("in3xes-buildbot" . "/Users/dave/src/in3xes-buildbot") ("gitolite-admin" . "/Users/dave/src/gitolite-admin") ("git-submodule-tools" . "/Users/dave/src/git-submodule-tools") ("fossbot" . "/Users/dave/src/fossbot-top/fossbot") ("emacs" . "/Users/dave/src/emacs") ("elisp" . "/Users/dave/src/elisp") ("elhome" . "/Users/dave/src/elhome") ("el-get-dev" . "/Users/dave/src/el-get-dev") ("el-get" . "/Users/dave/src/el-get") ("dwamacs" . "/Users/dave/src/dwamacs") ("redmine-boostpro" . "/Users/dave/src/corp/redmine-boostpro") ("xxx-options" . "/Users/dave/src/corp/zzzz/xxx-options") ("edg" . "/Users/dave/src/corp/edg") ("cpp11" . "/Users/dave/src/corp/cpp11") ("BestPractices" . "/Users/dave/src/corp/BestPractices") ("clang" . "/Users/dave/src/clang") ("buildbot" . "/Users/dave/src/buildbot") ("boost-git-svn-mirror" . "/Users/dave/src/boost/boost-git-svn-mirror") ("bbproto" . "/Users/dave/src/bbproto-top/bbproto") ("bbotpriv" . "/Users/dave/src/bbotpriv-top/bbotpriv") ("master" . "/Users/dave/src/bbot-remote/master") ("bbotpriv" . "/Users/dave/src/bbotpriv-top/bbotpriv") ("fossbot" . "/Users/dave/src/fossbot-top/fossbot")))
  magit-list-repos(("/Users/dave/src" "/Users/dave/src/bbotpriv-top" "/Users/dave/src/fossbot-top"))
  (let* ((repos (magit-list-repos magit-repo-dirs)) (reply (magit-completing-read "Git repository: " repos))) (file-name-as-directory (or (cdr (assoc reply repos)) (if (file-directory-p reply) (expand-file-name reply) (error "Not a repository or a directory: %s" reply)))))
  (if (and (not dir) magit-repo-dirs) (let* ((repos (magit-list-repos magit-repo-dirs)) (reply (magit-completing-read "Git repository: " repos))) (file-name-as-directory (or (cdr (assoc reply repos)) (if (file-directory-p reply) (expand-file-name reply) (error "Not a repository or a directory: %s" reply))))) (file-name-as-directory (read-directory-name "Git repository: " (or (magit-get-top-dir default-directory) default-directory))))
  magit-read-top-dir(nil)
  (if current-prefix-arg (magit-read-top-dir (> (prefix-numeric-value current-prefix-arg) 4)) (or (magit-get-top-dir default-directory) (magit-read-top-dir nil)))
  (list (if current-prefix-arg (magit-read-top-dir (> (prefix-numeric-value current-prefix-arg) 4)) (or (magit-get-top-dir default-directory) (magit-read-top-dir nil))))
  call-interactively(magit-status nil nil)
Jonas Bernoulli
Owner

Is this still an issue?

Jonas Bernoulli
Owner
tarsius commented

Please reopen if you experience this again.

Jonas Bernoulli tarsius closed this
Pieter Praet praet referenced this issue from a commit in praet/magit
Pieter Praet `magit-remove-conflicts': `delete-dups' from ALIST before populating …
…hash table

When a member of `magit-repo-dirs' is a parent/child/duplicate of one of
the other members, ALIST will contain duplicate key-value mappings, and
because of the way `magit-remove-conflicts' tries to uniquify the keys,
it will keep recursing on those associations until their keys are the
canonical path to the repo, after which it blows up because it can no
longer extract a higher-level directory to prefix them with.

Fixes #811 and #311.

Signed-off-by: Pieter Praet <pieter@praet.org>
91763a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.