GNU bug report logs - #79319
[PATCH] * lisp/vc/vc-dispatcher.el (vc-buffer-sync): Check buffer-file-name

Previous Next

Package: emacs;

Reported by: Lin Sun <sunlin7 <at> hotmail.com>

Date: Tue, 26 Aug 2025 19:40:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 79319 AT debbugs.gnu.org.

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#79319; Package emacs. (Tue, 26 Aug 2025 19:40:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lin Sun <sunlin7 <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 26 Aug 2025 19:40:02 GMT) Full text and rfc822 format available.

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

From: Lin Sun <sunlin7 <at> hotmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: [PATCH] * lisp/vc/vc-dispatcher.el (vc-buffer-sync): Check
 buffer-file-name 
Date: Tue, 26 Aug 2025 19:33:58 +0000
[Message part 1 (text/plain, inline)]
Hi,

I got an error when try to revert a buffer:
vc-revert: Wrong type argument: stringp, nil

Here is the backtrace:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  vc-buffer-sync(nil)
  vc-revert()
  funcall-interactively(vc-revert)
  command-execute(vc-revert)


It caused by reverting a buffer which has no file name (like create a buffer but not saving it).
 
This patch will check the `` bebuffer-file-name` before call subsequent function.
Please help review the patch, thanks

Best Regards
Lin
[0001-lisp-vc-vc-dispatcher.el-vc-buffer-sync-Check-buffer-file-name.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79319; Package emacs. (Thu, 28 Aug 2025 08:58:03 GMT) Full text and rfc822 format available.

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

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Lin Sun <sunlin7 <at> hotmail.com>
Cc: 79319 <at> debbugs.gnu.org
Subject: Re: bug#79319: [PATCH] * lisp/vc/vc-dispatcher.el (vc-buffer-sync):
 Check buffer-file-name
Date: Thu, 28 Aug 2025 09:57:28 +0100
Hello,

On Tue 26 Aug 2025 at 07:33pm GMT, Lin Sun wrote:

> Hi,
>
> I got an error when try to revert a buffer:
> vc-revert: Wrong type argument: stringp, nil
>
> Here is the backtrace:
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   vc-buffer-sync(nil)
>   vc-revert()
>   funcall-interactively(vc-revert)
>   command-execute(vc-revert)
>
>
> It caused by reverting a buffer which has no file name (like create a buffer but not saving it).
>
> This patch will check the `` bebuffer-file-name` before call subsequent function.
> Please help review the patch, thanks

I think that vc-revert should probably error out sooner for
non-file-visiting buffers, before it gets to calling vc-buffer-sync.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79319; Package emacs. (Sat, 30 Aug 2025 03:47:02 GMT) Full text and rfc822 format available.

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

From: Lin Sun <sunlin7 <at> hotmail.com>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: "79319 <at> debbugs.gnu.org" <79319 <at> debbugs.gnu.org>
Subject: Re: bug#79319: [PATCH] * lisp/vc/vc-dispatcher.el (vc-buffer-sync):
 Check buffer-file-name
Date: Sat, 30 Aug 2025 03:46:01 +0000
From: Sean Whitton <spwhitton <at> spwhitton.name>
Sent: Thursday, August 28, 2025 01:57 AM
>> Hi,
>>
>> I got an error when try to revert a buffer:
>> vc-revert: Wrong type argument: stringp, nil
>>
>> Here is the backtrace:
>> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>>   vc-buffer-sync(nil)
>>   vc-revert()
>>   funcall-interactively(vc-revert)
>>   command-execute(vc-revert)
>>
>>
>> It caused by reverting a buffer which has no file name (like create a buffer but not saving it).
>>
>> This patch will check the `` bebuffer-file-name` before call subsequent function.
>> Please help review the patch, thanks
>
>I think that vc-revert should probably error out sooner for
>non-file-visiting buffers, before it gets to calling vc-buffer-sync.

With this patch, emacs will give user friendly message: "File is not under version control".

Without the patch, it gives an unexpected error message "Wrong type argument: stringp, nil".



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79319; Package emacs. (Sun, 31 Aug 2025 15:40:01 GMT) Full text and rfc822 format available.

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

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Lin Sun <sunlin7 <at> hotmail.com>
Cc: "79319 <at> debbugs.gnu.org" <79319 <at> debbugs.gnu.org>
Subject: Re: bug#79319: [PATCH] * lisp/vc/vc-dispatcher.el (vc-buffer-sync):
 Check buffer-file-name
Date: Sun, 31 Aug 2025 16:38:58 +0100
Hello,

On Sat 30 Aug 2025 at 03:46am GMT, Lin Sun wrote:

> From: Sean Whitton <spwhitton <at> spwhitton.name>
> Sent: Thursday, August 28, 2025 01:57 AM
>>> Hi,
>>>
>>> I got an error when try to revert a buffer:
>>> vc-revert: Wrong type argument: stringp, nil
>>>
>>> Here is the backtrace:
>>> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>>>   vc-buffer-sync(nil)
>>>   vc-revert()
>>>   funcall-interactively(vc-revert)
>>>   command-execute(vc-revert)
>>>
>>>
>>> It caused by reverting a buffer which has no file name (like create a
>>> buffer but not saving it).
>>>
>>> This patch will check the `` bebuffer-file-name` before call subsequent function.
>>> Please help review the patch, thanks
>>
>>I think that vc-revert should probably error out sooner for
>>non-file-visiting buffers, before it gets to calling vc-buffer-sync.
>
> With this patch, emacs will give user friendly message: "File is not under version control".
>
> Without the patch, it gives an unexpected error message "Wrong type argument: stringp, nil".

I just installed a couple of fixes to vc-revert.  Do you think this
solves the original problem, or are further changes needed?  Thanks.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79319; Package emacs. (Mon, 01 Sep 2025 23:18:02 GMT) Full text and rfc822 format available.

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

From: Lin Sun <sunlin7 <at> hotmail.com>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: "79319 <at> debbugs.gnu.org" <79319 <at> debbugs.gnu.org>
Subject: Re: bug#79319: [PATCH] * lisp/vc/vc-dispatcher.el (vc-buffer-sync):
 Check buffer-file-name
Date: Mon, 1 Sep 2025 23:17:18 +0000
From: Sean Whitton <spwhitton <at> spwhitton.name>
Sent: Sunday, August 31, 2025 08:38 AM
> I just installed a couple of fixes to vc-revert.  Do you think this
> solves the original problem, or are further changes needed?  Thanks.

Original issue gone on latest vc. Emacs gives friendly message with the reproducing steps. No further changes needed. Thank you!



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79319; Package emacs. (Tue, 02 Sep 2025 08:16:02 GMT) Full text and rfc822 format available.

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

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Lin Sun <sunlin7 <at> hotmail.com>
Cc: "79319-done <at> debbugs.gnu.org" <79319 <at> debbugs.gnu.org>
Subject: Re: bug#79319: [PATCH] * lisp/vc/vc-dispatcher.el (vc-buffer-sync):
 Check buffer-file-name
Date: Tue, 02 Sep 2025 09:15:22 +0100
Version: 31.1

On Mon 01 Sep 2025 at 11:17pm GMT, Lin Sun wrote:

> From: Sean Whitton <spwhitton <at> spwhitton.name>
> Sent: Sunday, August 31, 2025 08:38 AM
>> I just installed a couple of fixes to vc-revert.  Do you think this
>> solves the original problem, or are further changes needed?  Thanks.
>
> Original issue gone on latest vc. Emacs gives friendly message with the reproducing steps. No further changes needed. Thank you!
>
>

Thanks, closing the bug.

-- 
Sean Whitton




This bug report was last modified 6 days ago.

Previous Next


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