GNU bug report logs - #18461
`vc-svn-registered' signals an error if a directory has be (re)moved.

Previous Next

Package: emacs;

Reported by: Emilio Lopes <eclig <at> gmx.net>

Date: Fri, 12 Sep 2014 16:11:02 UTC

Severity: normal

Tags: patch

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 18461 in the body.
You can then email your comments to 18461 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#18461; Package emacs. (Fri, 12 Sep 2014 16:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Emilio Lopes <eclig <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 12 Sep 2014 16:11:02 GMT) Full text and rfc822 format available.

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

From: Emilio Lopes <eclig <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: `vc-svn-registered' signals an error if a directory has be (re)moved.
Date: Fri, 12 Sep 2014 18:09:39 +0200
Here is a typical backtrace:

    Debugger entered--Lisp error: (error "No such directory found via
CDPATH environment variable")
      signal(error ("No such directory found via CDPATH environment variable"))
      error("No such directory found via CDPATH environment variable")
      cd("~/projects/shg/firmware-trunk/master-device-control/system-supervisor/")
      vc-svn-registered("~/projects/shg/firmware-trunk/master-device-control/system-supervisor/")
      apply(vc-svn-registered
"~/projects/shg/firmware-trunk/master-device-control/system-supervisor/")
      vc-call-backend(SVN registered
"~/projects/shg/firmware-trunk/master-device-control/system-supervisor/")
      ...

The following patch seems to fix the problem for me.

Regards,

 Emílio

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog    2014-09-08 13:57:19 +0000
+++ lisp/ChangeLog    2014-09-12 16:00:36 +0000
@@ -1,3 +1,10 @@
+2014-09-12  Emilio C. Lopes  <eclig <at> gmx.net>
+
+    * vc/vc-svn.el (vc-svn-registered): `cd' to the project root, not
+    to the file's directory, in case the directory has been (re)moved,
+    and do this inside the `ignore-errors' form.
+    (vc-svn-state): Ditto, modulo `ignore-errors'.
+
 2014-09-08  Sam Steingold  <sds <at> gnu.org>

     * progmodes/sql.el (sql-send-line-and-next): New command,

=== modified file 'lisp/vc/vc-svn.el'
--- lisp/vc/vc-svn.el    2014-01-01 07:43:34 +0000
+++ lisp/vc/vc-svn.el    2014-09-12 16:00:36 +0000
@@ -135,30 +135,30 @@

 (defun vc-svn-registered (file)
   "Check if FILE is SVN registered."
-  (when (vc-svn-root file)
-    (with-temp-buffer
-      (cd (file-name-directory file))
-      (let* (process-file-side-effects
-         (status
-             (condition-case nil
-                 ;; Ignore all errors.
-                 (vc-svn-command t t file "status" "-v")
-               ;; Some problem happened.  E.g. We can't find an `svn'
-               ;; executable.  We used to only catch `file-error' but when
-               ;; the process is run on a remote host via Tramp, the error
-               ;; is only reported via the exit status which is turned into
-               ;; an `error' by vc-do-command.
-               (error nil))))
-        (when (eq 0 status)
-      (let ((parsed (vc-svn-parse-status file)))
-        (and parsed (not (memq parsed '(ignored unregistered))))))))))
+  (let ((dir (vc-svn-root file)))
+    (when dir
+      (with-temp-buffer
+        (let* (process-file-side-effects
+               (status
+                (ignore-errors
+                  ;; In case some problem might happen.  E.g. We can't
+                  ;; find an `svn' executable.  We used to only catch
+                  ;; `file-error' but when the process is run on a
+                  ;; remote host via Tramp, the error is only reported
+                  ;; via the exit status which is turned into an
+                  ;; `error' by vc-do-command.
+                  (cd dir)
+                  (vc-svn-command t t file "status" "-v"))))
+          (when (eq 0 status)
+            (let ((parsed (vc-svn-parse-status file)))
+              (and parsed (not (memq parsed '(ignored unregistered)))))))))))

 (defun vc-svn-state (file &optional localp)
   "SVN-specific version of `vc-state'."
   (let (process-file-side-effects)
     (setq localp (or localp (vc-stay-local-p file 'SVN)))
     (with-temp-buffer
-      (cd (file-name-directory file))
+      (cd (vc-svn-root file))
       (vc-svn-command t 0 file "status" (if localp "-v" "-u"))
       (vc-svn-parse-status file))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18461; Package emacs. (Fri, 12 Sep 2014 17:30:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Emilio Lopes <eclig <at> gmx.net>
Cc: 18461 <at> debbugs.gnu.org
Subject: Re: bug#18461: `vc-svn-registered' signals an error if a directory
 has be (re)moved.
Date: Fri, 12 Sep 2014 13:28:30 -0400
> +                (ignore-errors
> +                  ;; In case some problem might happen.  E.g. We can't
> +                  ;; find an `svn' executable.  We used to only catch
> +                  ;; `file-error' but when the process is run on a
> +                  ;; remote host via Tramp, the error is only reported
> +                  ;; via the exit status which is turned into an
> +                  ;; `error' by vc-do-command.
> +                  (cd dir)
> +                  (vc-svn-command t t file "status" "-v"))))

Sounds OK, but I suggest we use with-demoted-errors, so the user is told
in case there's a problem.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18461; Package emacs. (Fri, 12 Sep 2014 20:38:05 GMT) Full text and rfc822 format available.

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

From: Emilio Lopes <eclig <at> gmx.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 18461 <at> debbugs.gnu.org
Subject: Re: bug#18461: `vc-svn-registered' signals an error if a directory
 has be (re)moved.
Date: Fri, 12 Sep 2014 22:36:52 +0200
2014-09-12 19:28 GMT+02:00 Stefan Monnier <monnier <at> iro.umontreal.ca>:
>> +                (ignore-errors
>> +                  ;; In case some problem might happen.  E.g. We can't
>> +                  ;; find an `svn' executable.  We used to only catch
>> +                  ;; `file-error' but when the process is run on a
>> +                  ;; remote host via Tramp, the error is only reported
>> +                  ;; via the exit status which is turned into an
>> +                  ;; `error' by vc-do-command.
>> +                  (cd dir)
>> +                  (vc-svn-command t t file "status" "-v"))))
>
> Sounds OK, but I suggest we use with-demoted-errors, so the user is told
> in case there's a problem.

Makes sense, thanks for looking at it.  I'll submit a new patch the next days.

 Emílio




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18461; Package emacs. (Mon, 15 Sep 2014 13:29:03 GMT) Full text and rfc822 format available.

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

From: Emilio Lopes <eclig <at> gmx.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 18461 <at> debbugs.gnu.org
Subject: Re: bug#18461: `vc-svn-registered' signals an error if a directory
 has be (re)moved.
Date: Mon, 15 Sep 2014 15:27:36 +0200
Here is an updated patch:

--- lisp/ChangeLog    2014-09-15 00:20:21 +0000
+++ lisp/ChangeLog    2014-09-15 13:22:54 +0000
@@ -1,3 +1,10 @@
+2014-09-15  Emilio C. Lopes  <eclig <at> gmx.net>
+
+    * vc/vc-svn.el (vc-svn-registered): `cd' to the project root, not
+    to the file's directory, in case the directory has been (re)moved,
+    and do this inside a `with-demoted-errors' form.
+    (vc-svn-state): Ditto, modulo `with-demoted-errors'.
+
 2014-09-15  Glenn Morris  <rgm <at> gnu.org>

     * image.el (image-multi-frame-p): Fix thinko - do not force

--- lisp/vc/vc-svn.el    2014-01-01 07:43:34 +0000
+++ lisp/vc/vc-svn.el    2014-09-15 13:22:54 +0000
@@ -135,30 +135,30 @@

 (defun vc-svn-registered (file)
   "Check if FILE is SVN registered."
-  (when (vc-svn-root file)
-    (with-temp-buffer
-      (cd (file-name-directory file))
-      (let* (process-file-side-effects
-         (status
-             (condition-case nil
-                 ;; Ignore all errors.
-                 (vc-svn-command t t file "status" "-v")
-               ;; Some problem happened.  E.g. We can't find an `svn'
-               ;; executable.  We used to only catch `file-error' but when
-               ;; the process is run on a remote host via Tramp, the error
-               ;; is only reported via the exit status which is turned into
-               ;; an `error' by vc-do-command.
-               (error nil))))
-        (when (eq 0 status)
-      (let ((parsed (vc-svn-parse-status file)))
-        (and parsed (not (memq parsed '(ignored unregistered))))))))))
+  (let ((dir (vc-svn-root file)))
+    (when dir
+      (with-temp-buffer
+        (let* ((process-file-side-effects nil)
+               (status
+                (with-demoted-errors "Error: %S"
+                  ;; In case some problem might happen.  E.g. We can't
+                  ;; find an `svn' executable.  We used to only catch
+                  ;; `file-error' but when the process is run on a
+                  ;; remote host via Tramp, the error is only reported
+                  ;; via the exit status which is turned into an
+                  ;; `error' by vc-do-command.
+                  (cd dir)
+                  (vc-svn-command t t file "status" "-v"))))
+          (when (eq 0 status)
+            (let ((parsed (vc-svn-parse-status file)))
+              (and parsed (not (memq parsed '(ignored unregistered)))))))))))

 (defun vc-svn-state (file &optional localp)
   "SVN-specific version of `vc-state'."
   (let (process-file-side-effects)
     (setq localp (or localp (vc-stay-local-p file 'SVN)))
     (with-temp-buffer
-      (cd (file-name-directory file))
+      (cd (vc-svn-root file))
       (vc-svn-command t 0 file "status" (if localp "-v" "-u"))
       (vc-svn-parse-status file))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18461; Package emacs. (Tue, 23 Feb 2016 12:10:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Emilio Lopes <eclig <at> gmx.net>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 18461 <at> debbugs.gnu.org
Subject: Re: bug#18461: `vc-svn-registered' signals an error if a directory
 has be (re)moved.
Date: Tue, 23 Feb 2016 23:08:58 +1100
Emilio Lopes <eclig <at> gmx.net> writes:

> +    * vc/vc-svn.el (vc-svn-registered): `cd' to the project root, not
> +    to the file's directory, in case the directory has been (re)moved,
> +    and do this inside a `with-demoted-errors' form.
> +    (vc-svn-state): Ditto, modulo `with-demoted-errors'.

From the discussion, and glancing at the code, this seems like it should
have gone in, but it apparently wasn't applied.  Is this patch still
required, and does it still work?  (I'm not an svn user, so I can't
really test.)

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18461; Package emacs. (Wed, 24 Feb 2016 00:23:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Emilio Lopes <eclig <at> gmx.net>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 18461 <at> debbugs.gnu.org
Subject: Re: bug#18461: `vc-svn-registered' signals an error if a directory
 has be (re)moved.
Date: Wed, 24 Feb 2016 02:22:23 +0200
On 02/23/2016 02:08 PM, Lars Ingebrigtsen wrote:

> From the discussion, and glancing at the code, this seems like it should
> have gone in, but it apparently wasn't applied.  Is this patch still
> required, and does it still work?  (I'm not an svn user, so I can't
> really test.)

I _think_ this bug may have been fixed in 
83114ccf77d2a5d59fccbdbda6edefacce1b979e, in the course of fixing 
http://debbugs.gnu.org/21984.

(Either way, Emilio, please attach the patch as a file next time; I 
wasn't able to apply this one using any automated means).




Reply sent to Lars Ingebrigtsen <larsi <at> gnus.org>:
You have taken responsibility. (Wed, 24 Feb 2016 01:44:02 GMT) Full text and rfc822 format available.

Notification sent to Emilio Lopes <eclig <at> gmx.net>:
bug acknowledged by developer. (Wed, 24 Feb 2016 01:44:02 GMT) Full text and rfc822 format available.

Message #25 received at 18461-done <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, Emilio Lopes <eclig <at> gmx.net>,
 18461-done <at> debbugs.gnu.org
Subject: Re: bug#18461: `vc-svn-registered' signals an error if a directory
 has be (re)moved.
Date: Wed, 24 Feb 2016 12:43:08 +1100
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> I _think_ this bug may have been fixed in
> 83114ccf77d2a5d59fccbdbda6edefacce1b979e, in the course of fixing
> http://debbugs.gnu.org/21984.

Ok; I'll close the bug.  If it's still a problem, we can reopen...

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Mar 2016 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 93 days ago.

Previous Next


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