GNU bug report logs - #21319
`package-install-file' fails with CRLF (Windows) line endings

Previous Next

Package: emacs;

Reported by: steckerhalter <emacs <at> postmomentum.ch>

Date: Sat, 22 Aug 2015 05:39:02 UTC

Severity: minor

Tags: moreinfo

Found in version 25.0.50

Fixed in version 29.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 21319 in the body.
You can then email your comments to 21319 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#21319; Package emacs. (Sat, 22 Aug 2015 05:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to steckerhalter <emacs <at> postmomentum.ch>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 22 Aug 2015 05:39:02 GMT) Full text and rfc822 format available.

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

From: steckerhalter <emacs <at> postmomentum.ch>
To: bug-gnu-emacs <at> gnu.org
Subject: `package-install-file' fails with CRLF (Windows) line endings
Date: Sat, 22 Aug 2015 06:30:30 +0200
package.el contains this code:

(defun package-install-file (file)
  "Install a package from a file.
The file can either be a tar file or an Emacs Lisp file."
  (interactive "fPackage file name: ")
  (with-temp-buffer
    (insert-file-contents-literally file)
    (when (string-match "\\.tar\\'" file) (tar-mode))
    (package-install-from-buffer)))

Since `insert-file-contents-literally' does not do any conversion
`package-buffer-info' fails to parse the info if the file is .el and
contains CRLF line endings. It then errors out with:

Debugger entered--Lisp error: (error "Package lacks a \"Version\" or
\"Package-Version\" header")
  signal(error ("Package lacks a \"Version\" or \"Package-Version\" header"))
  error("Package lacks a \"Version\" or \"Package-Version\" header")
  package-buffer-info()

This affects all recent Emacs versions (including trunk).

What we did now is to replace `insert-file-contents-literally' with
`insert-file-contents' dynamically for non-tar files and that seems to
work, although I'm not sure if that's a good solution since I don't
know if there might be side-effects somewhere that can cause other
problems.

The other solution I can think of might be to adapt the regexp in
`package-buffer-info` so that in can deal with CRLF.

cheers,
steckerhalter




Merged 20309 21319. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 02 Aug 2019 12:13:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21319; Package emacs. (Tue, 22 Oct 2019 01:06:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: steckerhalter <emacs <at> postmomentum.ch>
Cc: 20309 <at> debbugs.gnu.org, 21319 <at> debbugs.gnu.org
Subject: Re: bug#21319: `package-install-file' fails with CRLF (Windows) line
 endings
Date: Tue, 22 Oct 2019 03:04:59 +0200
steckerhalter <emacs <at> postmomentum.ch> writes:

> package.el contains this code:
>
> (defun package-install-file (file)
>   "Install a package from a file.
> The file can either be a tar file or an Emacs Lisp file."
>   (interactive "fPackage file name: ")
>   (with-temp-buffer
>     (insert-file-contents-literally file)
>     (when (string-match "\\.tar\\'" file) (tar-mode))
>     (package-install-from-buffer)))
>
> Since `insert-file-contents-literally' does not do any conversion
> `package-buffer-info' fails to parse the info if the file is .el and
> contains CRLF line endings. It then errors out with:
>
> Debugger entered--Lisp error: (error "Package lacks a \"Version\" or
> \"Package-Version\" header")
>   signal(error ("Package lacks a \"Version\" or \"Package-Version\" header"))
>   error("Package lacks a \"Version\" or \"Package-Version\" header")
>   package-buffer-info()
>
> This affects all recent Emacs versions (including trunk).

This was reported 4 years ago, but unfortunately never got a reply at
the time.

Are you still seeing this on a recent version of Emacs?  If yes, could
you please provide a minimal example file which fails to install?

Also, why does your file have these line endings in the first place?
Was this file written in Emacs?  I'm trying to understand if this is
an important use case or the common scenario for users of MS-Windows,
since I don't use it myself.

Best regards,
Stefan Kangas




Disconnected #21319 from all other report(s). Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 22 Oct 2019 14:48:01 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 22 Oct 2019 14:48:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21319; Package emacs. (Tue, 22 Oct 2019 14:52:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: steckerhalter <emacs <at> postmomentum.ch>
Cc: 21319 <at> debbugs.gnu.org
Subject: Re: bug#21319: `package-install-file' fails with CRLF (Windows) line
 endings
Date: Tue, 22 Oct 2019 16:50:44 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> steckerhalter <emacs <at> postmomentum.ch> writes:
>
> > package.el contains this code:
> >
> > (defun package-install-file (file)
> >   "Install a package from a file.
> > The file can either be a tar file or an Emacs Lisp file."
> >   (interactive "fPackage file name: ")
> >   (with-temp-buffer
> >     (insert-file-contents-literally file)
> >     (when (string-match "\\.tar\\'" file) (tar-mode))
> >     (package-install-from-buffer)))
> >
> > Since `insert-file-contents-literally' does not do any conversion
> > `package-buffer-info' fails to parse the info if the file is .el and
> > contains CRLF line endings. It then errors out with:
> >
> > Debugger entered--Lisp error: (error "Package lacks a \"Version\" or
> > \"Package-Version\" header")
> >   signal(error ("Package lacks a \"Version\" or \"Package-Version\" header"))
> >   error("Package lacks a \"Version\" or \"Package-Version\" header")
> >   package-buffer-info()
> >
> > This affects all recent Emacs versions (including trunk).
>
> This was reported 4 years ago, but unfortunately never got a reply at
> the time.
>
> Are you still seeing this on a recent version of Emacs?  If yes, could
> you please provide a minimal example file which fails to install?
>
> Also, why does your file have these line endings in the first place?
> Was this file written in Emacs?  I'm trying to understand if this is
> an important use case or the common scenario for users of MS-Windows,
> since I don't use it myself.

This was merged with Bug#20309, which was closed.  I suspect that the
bugs are most probably different, so I've unmerged this bug and
reopened it.  Please disregard any message saying that this bug is
closed for now.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21319; Package emacs. (Fri, 29 Nov 2019 12:59:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: steckerhalter <emacs <at> postmomentum.ch>
Cc: 21319 <at> debbugs.gnu.org
Subject: Re: bug#21319: `package-install-file' fails with CRLF (Windows)
 line endings
Date: Fri, 29 Nov 2019 13:58:15 +0100
Stefan Kangas <stefan <at> marxist.se> writes:

> steckerhalter <emacs <at> postmomentum.ch> writes:
>
>> package.el contains this code:
>>
>> (defun package-install-file (file)
>>   "Install a package from a file.
>> The file can either be a tar file or an Emacs Lisp file."
>>   (interactive "fPackage file name: ")
>>   (with-temp-buffer
>>     (insert-file-contents-literally file)
>>     (when (string-match "\\.tar\\'" file) (tar-mode))
>>     (package-install-from-buffer)))
>>
>> Since `insert-file-contents-literally' does not do any conversion
>> `package-buffer-info' fails to parse the info if the file is .el and
>> contains CRLF line endings. It then errors out with:
>>
>> Debugger entered--Lisp error: (error "Package lacks a \"Version\" or
>> \"Package-Version\" header")
>>   signal(error ("Package lacks a \"Version\" or \"Package-Version\" header"))
>>   error("Package lacks a \"Version\" or \"Package-Version\" header")
>>   package-buffer-info()
>>
>> This affects all recent Emacs versions (including trunk).
>
> This was reported 4 years ago, but unfortunately never got a reply at
> the time.
>
> Are you still seeing this on a recent version of Emacs?  If yes, could
> you please provide a minimal example file which fails to install?
>
> Also, why does your file have these line endings in the first place?
> Was this file written in Emacs?  I'm trying to understand if this is
> an important use case or the common scenario for users of MS-Windows,
> since I don't use it myself.

We have gotten no more information within five weeks here.

Does anyone think it's important to support CRLF line endings in
package.el?  I don't use Windows, so I'm not sure that I understand if
this is an important use case or not.  But AFAIK, and this might be
completely wrong, you should be fine as long as you edit the file in
Emacs?

I'll give this a couple of weeks more, and if I don't hear anything
else within that time, I'll just go ahead and assume that what I'm
saying is correct and therefore close this bug report.

Please speak up if any of the above is incorrect and this bug should
remain open.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21319; Package emacs. (Fri, 29 Nov 2019 13:30:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: emacs <at> postmomentum.ch, 21319 <at> debbugs.gnu.org
Subject: Re: bug#21319: `package-install-file' fails with CRLF (Windows) line
 endings
Date: Fri, 29 Nov 2019 15:29:55 +0200
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Fri, 29 Nov 2019 13:58:15 +0100
> Cc: 21319 <at> debbugs.gnu.org
> 
> >> (defun package-install-file (file)
> >>   "Install a package from a file.
> >> The file can either be a tar file or an Emacs Lisp file."
> >>   (interactive "fPackage file name: ")
> >>   (with-temp-buffer
> >>     (insert-file-contents-literally file)
> >>     (when (string-match "\\.tar\\'" file) (tar-mode))
> >>     (package-install-from-buffer)))
> >>
> >> Since `insert-file-contents-literally' does not do any conversion
> >> `package-buffer-info' fails to parse the info if the file is .el and
> >> contains CRLF line endings. It then errors out with:
> >>
> >> Debugger entered--Lisp error: (error "Package lacks a \"Version\" or
> >> \"Package-Version\" header")
> >>   signal(error ("Package lacks a \"Version\" or \"Package-Version\" header"))
> >>   error("Package lacks a \"Version\" or \"Package-Version\" header")
> >>   package-buffer-info()
> >>
> >> This affects all recent Emacs versions (including trunk).
> >
> > This was reported 4 years ago, but unfortunately never got a reply at
> > the time.
> >
> > Are you still seeing this on a recent version of Emacs?  If yes, could
> > you please provide a minimal example file which fails to install?

The code is still there.  One can see if the problem happens by making
a package that is a single .el file with CRLF EOL format.

> > Also, why does your file have these line endings in the first place?
> > Was this file written in Emacs?  I'm trying to understand if this is
> > an important use case or the common scenario for users of MS-Windows,
> > since I don't use it myself.

When a file is created on MS-Windows, even if it's a .el file, its EOL
format is by default identical to that of the underlying platform's
defaults.  On MS-Windows, you will get CRLF, yes.

> Does anyone think it's important to support CRLF line endings in
> package.el?

I don't know if this is important, but then fix is trivial: use
insert-file-contents after binding coding-system-for-read to raw-text.

> I don't use Windows, so I'm not sure that I understand if
> this is an important use case or not.  But AFAIK, and this might be
> completely wrong, you should be fine as long as you edit the file in
> Emacs?

AFAIU, the problem is that one cannot install such a package, because
the current code signals an error.




Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 15 Jan 2020 04:30:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21319; Package emacs. (Sat, 29 Jan 2022 17:04:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: emacs <at> postmomentum.ch, Stefan Kangas <stefan <at> marxist.se>,
 21319 <at> debbugs.gnu.org
Subject: Re: bug#21319: `package-install-file' fails with CRLF (Windows)
 line endings
Date: Sat, 29 Jan 2022 18:03:18 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Does anyone think it's important to support CRLF line endings in
>> package.el?
>
> I don't know if this is important, but then fix is trivial: use
> insert-file-contents after binding coding-system-for-read to raw-text.

I think I remember this being fixed recently?  Anybody remember?

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




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 29 Jan 2022 17:04:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21319; Package emacs. (Sat, 29 Jan 2022 17:09:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: emacs <at> postmomentum.ch, stefan <at> marxist.se, 21319 <at> debbugs.gnu.org
Subject: Re: bug#21319: `package-install-file' fails with CRLF (Windows)
 line endings
Date: Sat, 29 Jan 2022 19:07:54 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Stefan Kangas <stefan <at> marxist.se>,  emacs <at> postmomentum.ch,
>   21319 <at> debbugs.gnu.org
> Date: Sat, 29 Jan 2022 18:03:18 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> Does anyone think it's important to support CRLF line endings in
> >> package.el?
> >
> > I don't know if this is important, but then fix is trivial: use
> > insert-file-contents after binding coding-system-for-read to raw-text.
> 
> I think I remember this being fixed recently?  Anybody remember?

Yes, it should be fixed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21319; Package emacs. (Sat, 29 Jan 2022 17:10:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: emacs <at> postmomentum.ch, stefan <at> marxist.se, 21319 <at> debbugs.gnu.org
Subject: Re: bug#21319: `package-install-file' fails with CRLF (Windows)
 line endings
Date: Sat, 29 Jan 2022 18:09:04 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> I think I remember this being fixed recently?  Anybody remember?
>
> Yes, it should be fixed.

Thanks; closing this bug report, then.

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




bug marked as fixed in version 29.1, send any further explanations to 21319 <at> debbugs.gnu.org and steckerhalter <emacs <at> postmomentum.ch> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 29 Jan 2022 17:10: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, 27 Feb 2022 12:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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