GNU bug report logs - #39285
28.0.50; vc-dir on gitdir results in error

Previous Next

Package: emacs;

Reported by: "Mark A. Hershberger" <mah <at> everybody.org>

Date: Sat, 25 Jan 2020 21:56:02 UTC

Severity: normal

Tags: fixed

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39285 in the body.
You can then email your comments to 39285 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#39285; Package emacs. (Sat, 25 Jan 2020 21:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Mark A. Hershberger" <mah <at> everybody.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 25 Jan 2020 21:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Mark A. Hershberger" <mah <at> everybody.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; vc-dir on gitdir results in error
Date: Sat, 25 Jan 2020 16:55:21 -0500
While trying projectile's "Browse dirty projects", I hit an error.  I
was able to reproduce this error using

    (vc-dir "/home/mah/work/code/emacs/.git/")

or any other git dir.

Here is the backtrace:

  substring(nil 0 0)
  replace-regexp-in-string("^stash@" "             " nil)
  vc-git-stash-list()
  vc-git-dir-extra-headers("/home/mah/work/code/emacs/.git/")
  apply(vc-git-dir-extra-headers "/home/mah/work/code/emacs/.git/")
  vc-call-backend(Git dir-extra-headers "/home/mah/work/code/emacs/.git/")
  vc-dir-headers(Git "/home/mah/work/code/emacs/.git/")
  vc-dir-refresh()
  vc-dir-mode()
  vc-dir("/home/mah/work/code/emacs/.git/")
  eval((vc-dir "/home/mah/work/code/emacs/.git/") t)
  eval-expression((vc-dir "/home/mah/work/code/emacs/.git/") nil nil 127)
  funcall-interactively(eval-expression (vc-dir "/home/mah/work/code/emacs/.git/") nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)


In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2020-01-24 built on silk
Repository revision: ff630b56939541752097e5cc87c3db1de68d4c5f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Recent messages:
Entering debugger...
Mark set
next-line: End of buffer [10 times]
Saved text from "  substring(nil 0 0)
  replace-regexp-in"
Back to top level
Quit
Making completion list...
user-error: Beginning of history; no preceding item
user-error: End of history; no default available [2 times]

Configured using:
 'configure --with-modules --with-xwidgets --with-gconf --with-cairo
 --with-imagemagick'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS GCONF
GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE
HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM
MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: VC dir

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils thingatpt help-fns radix-tree cl-print debug backtrace
help-mode find-func vc-git diff-mode easymenu easy-mmode vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs vc-dir seq byte-opt gv bytecomp
byte-compile cconv ewoc vc cl-loaddefs cl-lib vc-dispatcher tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
xwidget-internal cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 63534 5598)
 (symbols 48 7744 1)
 (strings 32 22875 1739)
 (string-bytes 1 697483)
 (vectors 16 12421)
 (vector-slots 8 155309 11316)
 (floats 8 27 73)
 (intervals 56 347 0)
 (buffers 1000 16))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39285; Package emacs. (Mon, 27 Jan 2020 05:50:01 GMT) Full text and rfc822 format available.

Message #8 received at 39285 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: "Mark A. Hershberger" <mah <at> everybody.org>, 39285 <at> debbugs.gnu.org
Subject: Re: bug#39285: 28.0.50; vc-dir on gitdir results in error
Date: Mon, 27 Jan 2020 08:49:20 +0300
Hi there!

On 26.01.2020 0:55, Mark A. Hershberger wrote:
> 
> While trying projectile's "Browse dirty projects", I hit an error.  I
> was able to reproduce this error using
> 
>      (vc-dir "/home/mah/work/code/emacs/.git/")
> 
> or any other git dir.

What kind of directory is this?

Normally, .git is a utility directory which is not considered part of 
the work tree. So most git commands fail inside it.

I suppose vc-git-stash-list could handle this better, but you still 
won't get anything better than a misleadingly empty VC-Dir buffer. The 
current behavior might even be better in that regard.

This patch would make it shut up, though:

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 61e6c642d1..9b3f3c6545 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1688,12 +1688,14 @@ vc-git-stash-snapshot
   (vc-resynch-buffer (vc-git-root default-directory) t t))

 (defun vc-git-stash-list ()
-  (delete
-   ""
-   (split-string
-    (replace-regexp-in-string
-     "^stash@" "             " (vc-git--run-command-string nil "stash" 
"list"))
-    "\n")))
+  (let ((out (vc-git--run-command-string nil "stash" "list")))
+    (when out
+      (delete
+       ""
+       (split-string
+        (replace-regexp-in-string
+         "^stash@" "             " out)
+        "\n")))))

 (defun vc-git-stash-get-at-point (point)
   (save-excursion




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39285; Package emacs. (Mon, 27 Jan 2020 11:12:01 GMT) Full text and rfc822 format available.

Message #11 received at 39285 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 39285 <at> debbugs.gnu.org, "Mark A. Hershberger" <mah <at> everybody.org>
Subject: Re: bug#39285: 28.0.50; vc-dir on gitdir results in error
Date: Mon, 27 Jan 2020 12:11:28 +0100
>>>>> On Mon, 27 Jan 2020 08:49:20 +0300, Dmitry Gutov <dgutov <at> yandex.ru> said:

    Dmitry> Hi there!
    Dmitry> On 26.01.2020 0:55, Mark A. Hershberger wrote:
    >> While trying projectile's "Browse dirty projects", I hit an error.
    >> I
    >> was able to reproduce this error using
    >> (vc-dir "/home/mah/work/code/emacs/.git/")
    >> or any other git dir.

    Dmitry> What kind of directory is this?

    Dmitry> Normally, .git is a utility directory which is not considered part of
    Dmitry> the work tree. So most git commands fail inside it.

Shouldn't 'vc-dir' have errored out before, since the ".git" directory
is not vc-controlled?

    Dmitry> I suppose vc-git-stash-list could handle this better, but you still
    Dmitry> won't get anything better than a misleadingly empty VC-Dir buffer. The 
    Dmitry> current behavior might even be better in that regard.

    Dmitry> This patch would make it shut up, though:

    Dmitry> diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
    Dmitry> index 61e6c642d1..9b3f3c6545 100644
    Dmitry> --- a/lisp/vc/vc-git.el
    Dmitry> +++ b/lisp/vc/vc-git.el
    Dmitry> @@ -1688,12 +1688,14 @@ vc-git-stash-snapshot
    Dmitry>    (vc-resynch-buffer (vc-git-root default-directory) t t))

    Dmitry>  (defun vc-git-stash-list ()
    Dmitry> -  (delete
    Dmitry> -   ""
    Dmitry> -   (split-string
    Dmitry> -    (replace-regexp-in-string
    Dmitry> -     "^stash@" "             " (vc-git--run-command-string nil
    Dmitry>       "stash" "list"))
    Dmitry> -    "\n")))
    Dmitry> +  (let ((out (vc-git--run-command-string nil "stash" "list")))
    Dmitry> +    (when out
    Dmitry> +      (delete
    Dmitry> +       ""
    Dmitry> +       (split-string
    Dmitry> +        (replace-regexp-in-string
    Dmitry> +         "^stash@" "             " out)
    Dmitry> +        "\n")))))

    Dmitry>  (defun vc-git-stash-get-at-point (point)
    Dmitry>    (save-excursion

LGTM.

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39285; Package emacs. (Mon, 27 Jan 2020 13:02:01 GMT) Full text and rfc822 format available.

Message #14 received at 39285 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 39285 <at> debbugs.gnu.org, "Mark A. Hershberger" <mah <at> everybody.org>
Subject: Re: bug#39285: 28.0.50; vc-dir on gitdir results in error
Date: Mon, 27 Jan 2020 16:00:51 +0300
On 27.01.2020 14:11, Robert Pluim wrote:
> Shouldn't 'vc-dir' have errored out before, since the ".git" directory
> is not vc-controlled?

Not... really. I mean, we can add that error, but it doesn't error out 
a) because we consider any directory inside a working dir to belong to 
it, b) because of some defensive programming.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39285; Package emacs. (Sun, 20 Sep 2020 10:15:02 GMT) Full text and rfc822 format available.

Message #17 received at 39285 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 39285 <at> debbugs.gnu.org, "Mark A. Hershberger" <mah <at> everybody.org>
Subject: Re: bug#39285: 28.0.50; vc-dir on gitdir results in error
Date: Sun, 20 Sep 2020 12:14:03 +0200
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> I suppose vc-git-stash-list could handle this better, but you still
> won't get anything better than a misleadingly empty VC-Dir buffer. The
> current behavior might even be better in that regard.
>
> This patch would make it shut up, though:

I think the misleadingly empty directory is better then the cryptic
error, so I applied your patch to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 20 Sep 2020 10:15:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 39285 <at> debbugs.gnu.org and "Mark A. Hershberger" <mah <at> everybody.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 20 Sep 2020 10:15:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Oct 2020 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 184 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.