unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
@ 2020-01-18  4:26 Yuan Fu
  2020-01-18  9:03 ` Eli Zaretskii
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Yuan Fu @ 2020-01-18  4:26 UTC (permalink / raw)
  To: 39168


- dump an image: emacs --batch -q --eval '(dump-emacs-portable
  "~/.emacs.d/emacs.pdmp")'
- start emacs: ~/bin/emacs -q --dump-file=/Users/yuan/.emacs.d/emacs.pdmp -g 151x50
- error: command-line-1: Unknown option ‘--dump-file=/Users/yuan/.emacs.d/emacs.pdmp’


In GNU Emacs 27.0.50 (build 3, x86_64-apple-darwin19.0.0, NS appkit-1894.10 Version 10.15.1 (Build 19B88))
of 2019-11-30 built on missSilver
Repository revision: e2828795d73637577c7726965974a047fe2d7119
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.2

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
command-line-1: Unknown option ‘--dump-file=/Users/yuan/.emacs.d/emacs.pdmp’
Configured using:
'configure --with-modules --with-pdumper=yes
--oldincludedir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2/'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS PDUMPER LCMS2

Important settings:
  value of $LC_CTYPE: UTF-8
  value of $LANG: en_CN.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
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 kqueue cocoa ns lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 42181 10308)
(symbols 48 5889 1)
(strings 32 15052 1161)
(string-bytes 1 491530)
(vectors 16 9263)
(vector-slots 8 118824 9670)
(floats 8 19 27)
(intervals 56 127 0)
(buffers 1000 11))





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-01-18  4:26 bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags Yuan Fu
@ 2020-01-18  9:03 ` Eli Zaretskii
  2020-01-18 14:29   ` Yuan Fu
  2020-04-24 15:58 ` Yuan Fu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2020-01-18  9:03 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 39168

> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 17 Jan 2020 23:26:48 -0500
> 
> 
> - dump an image: emacs --batch -q --eval '(dump-emacs-portable
>   "~/.emacs.d/emacs.pdmp")'
> - start emacs: ~/bin/emacs -q --dump-file=/Users/yuan/.emacs.d/emacs.pdmp -g 151x50
> - error: command-line-1: Unknown option ‘--dump-file=/Users/yuan/.emacs.d/emacs.pdmp’

Not _any_ other flag, but flags parsed in command-line-1.

If we restored Emacs from a dump file, we should filter --dump-file
(and the following argument, if --dump-file doesn't end in a '=') in
init_cmdargs, so that startup.el doesn't see it.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-01-18  9:03 ` Eli Zaretskii
@ 2020-01-18 14:29   ` Yuan Fu
  2020-01-18 15:23     ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Yuan Fu @ 2020-01-18 14:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39168

BTW, I can’t use —dump-file flag with ~, otherwise it complains

    emacs: could not load dump file "~/.emacs.d/cache/emacs.pdmp": could not open file

Using a root path (/Users/yuan/.emacs.d/…) works fine. Is this expected?

Yuan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-01-18 14:29   ` Yuan Fu
@ 2020-01-18 15:23     ` Eli Zaretskii
  0 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2020-01-18 15:23 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 39168

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 18 Jan 2020 09:29:02 -0500
> Cc: 39168@debbugs.gnu.org
> 
> BTW, I can’t use —dump-file flag with ~, otherwise it complains
> 
>     emacs: could not load dump file "~/.emacs.d/cache/emacs.pdmp": could not open file
> 
> Using a root path (/Users/yuan/.emacs.d/…) works fine. Is this expected?

Yes, I think so.  Emacs loads the dump file very early during startup,
and the various known directories are not yet set up at that point.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-01-18  4:26 bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags Yuan Fu
  2020-01-18  9:03 ` Eli Zaretskii
@ 2020-04-24 15:58 ` Yuan Fu
  2020-04-24 16:31   ` Eli Zaretskii
  2022-02-10  7:37 ` Lars Ingebrigtsen
  2022-02-19 23:52 ` bug#39168: Fwd: " Yuan Fu
  3 siblings, 1 reply; 14+ messages in thread
From: Yuan Fu @ 2020-04-24 15:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39168


I’m still seeing this in the latest master build. Could you give me some
pointers on how to fix this? If it’s not too complicated maybe I can fix
it.

Yuan





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-04-24 15:58 ` Yuan Fu
@ 2020-04-24 16:31   ` Eli Zaretskii
  2020-04-24 17:45     ` Yuan Fu
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2020-04-24 16:31 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 39168

> From: Yuan Fu <ykf5041@psu.edu>
> Date: Fri, 24 Apr 2020 11:58:05 -0400
> Cc: 39168@debbugs.gnu.org
> 
> I’m still seeing this in the latest master build. Could you give me some
> pointers on how to fix this?

I thought I did just that in

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39168#8

Do you have follow-up questions?





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-04-24 16:31   ` Eli Zaretskii
@ 2020-04-24 17:45     ` Yuan Fu
  2020-04-24 18:05       ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Yuan Fu @ 2020-04-24 17:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39168



> On Apr 24, 2020, at 12:31 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <ykf5041@psu.edu>
>> Date: Fri, 24 Apr 2020 11:58:05 -0400
>> Cc: 39168@debbugs.gnu.org
>> 
>> I’m still seeing this in the latest master build. Could you give me some
>> pointers on how to fix this?
> 
> I thought I did just that in
> 
>  https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdebbugs.gnu.org%2Fcgi%2Fbugreport.cgi%3Fbug%3D39168%238&amp;data=02%7C01%7Cykf5041%40psu.edu%7C73225549a67c47daa17708d7e86d09d7%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637233427328246054&amp;sdata=NKZV6igzz0KyKIbM%2Fla8f4DPb7quGe2CdV1aA%2FqSSdA%3D&amp;reserved=0
> 
> Do you have follow-up questions?

Ah, yes. How can I check if Emacs is restored from a portable dump file? I see strcmp (temacs, "pdump”) in main but I don’t think that’s in scope in init_cmdargs. Thanks.

Yuan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-04-24 17:45     ` Yuan Fu
@ 2020-04-24 18:05       ` Eli Zaretskii
  2020-04-24 19:44         ` Yuan Fu
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2020-04-24 18:05 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 39168

> From: Yuan Fu <ykf5041@psu.edu>
> Date: Fri, 24 Apr 2020 13:45:51 -0400
> Cc: 39168@debbugs.gnu.org
> 
> > Do you have follow-up questions?
> 
> Ah, yes. How can I check if Emacs is restored from a portable dump file?

One way is to use the function pdumper-stats.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-04-24 18:05       ` Eli Zaretskii
@ 2020-04-24 19:44         ` Yuan Fu
  2020-04-24 20:24           ` Yuan Fu
  0 siblings, 1 reply; 14+ messages in thread
From: Yuan Fu @ 2020-04-24 19:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39168



> On Apr 24, 2020, at 2:05 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <ykf5041@psu.edu>
>> Date: Fri, 24 Apr 2020 13:45:51 -0400
>> Cc: 39168@debbugs.gnu.org
>> 
>>> Do you have follow-up questions?
>> 
>> Ah, yes. How can I check if Emacs is restored from a portable dump file?
> 
> One way is to use the function pdumper-stats.

Thinking more about it, maybe I shouldn’t check if Emacs is restored from a portable dump file, since having “—dump-file” in argv should mean that Emacs is restored from a portable dump file anyway.

Yuan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-04-24 19:44         ` Yuan Fu
@ 2020-04-24 20:24           ` Yuan Fu
  2020-07-24  0:18             ` Yuan Fu
  0 siblings, 1 reply; 14+ messages in thread
From: Yuan Fu @ 2020-04-24 20:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39168

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

Here is my first attempt. The implementation of argmatch gives me an impression that when the flag only have one dash, you are not supposed to add “=“ after it. IOW, -dump-file=xxx is a misuse. BTW, I don’t see a test for emacs startup in /test/src. Are there test cases that I should test against?


[-- Attachment #2: dump-file.patch --]
[-- Type: application/octet-stream, Size: 1524 bytes --]

diff --git a/src/emacs.c b/src/emacs.c
index ea9c4cd79d..a968b191be 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -569,11 +569,28 @@ init_cmdargs (int argc, char **argv, int skip_args, char const *original_pwd)
   for (i = argc - 1; i >= 0; i--)
     {
       if (i == 0 || i > skip_args)
-	/* For the moment, we keep arguments as is in unibyte strings.
-	   They are decoded in the function command-line after we know
-	   locale-coding-system.  */
-	Vcommand_line_args
-	  = Fcons (build_unibyte_string (argv[i]), Vcommand_line_args);
+        {
+#ifdef HAVE_PDUMPER
+          /* If Emacs is restored from a portable dump file, filter
+             out the --dump-file flag (and the following argument, if
+             --dump-file doesn't end in a "="), so that startup.el
+             doesn't see it. (Bug#39168) */
+          if (strcmp (argv[i], "-dump-file") == 0
+              || (strlen (argv[i]) >= 10
+                  && strncmp (argv[i], "--dumpfile", 6) == 0))
+            {
+              if (strchr (argv[i], '=') == NULL)
+                Vcommand_line_args = Fcdr (Vcommand_line_args);
+              continue;
+            }
+          else
+#endif
+            /* For the moment, we keep arguments as is in unibyte strings.
+               They are decoded in the function command-line after we know
+               locale-coding-system.  */
+            Vcommand_line_args
+              = Fcons (build_unibyte_string (argv[i]), Vcommand_line_args);
+        }
     }
 
   unbind_to (count, Qnil);

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-04-24 20:24           ` Yuan Fu
@ 2020-07-24  0:18             ` Yuan Fu
  0 siblings, 0 replies; 14+ messages in thread
From: Yuan Fu @ 2020-07-24  0:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39168

I almost forgot about this, any updates?

Yuan

> On Apr 24, 2020, at 4:24 PM, Yuan Fu <ykf5041@psu.edu> wrote:
> 
> Here is my first attempt. The implementation of argmatch gives me an impression that when the flag only have one dash, you are not supposed to add “=“ after it. IOW, -dump-file=xxx is a misuse. BTW, I don’t see a test for emacs startup in /test/src. Are there test cases that I should test against?
> 
> <dump-file.patch>






^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-01-18  4:26 bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags Yuan Fu
  2020-01-18  9:03 ` Eli Zaretskii
  2020-04-24 15:58 ` Yuan Fu
@ 2022-02-10  7:37 ` Lars Ingebrigtsen
  2022-02-19 23:51   ` Yuan Fu
  2022-02-19 23:52 ` bug#39168: Fwd: " Yuan Fu
  3 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-10  7:37 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 39168

Yuan Fu <casouri@gmail.com> writes:

> - dump an image: emacs --batch -q --eval '(dump-emacs-portable
>   "~/.emacs.d/emacs.pdmp")'
> - start emacs: ~/bin/emacs -q --dump-file=/Users/yuan/.emacs.d/emacs.pdmp -g 151x50
> - error: command-line-1: Unknown option ‘--dump-file=/Users/yuan/.emacs.d/emacs.pdmp’

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I tried reproducing this on the current Emacs trunk:

larsi@giant:~/src/emacs/trunk$ ./src/emacs --batch -q --eval '(dump-emacs-portable  "/tmp/emacs.pdmp")'
Dumping fingerprint: 242a38e947fb351c885b84edcc58743b99c0803abfc37d2f3a62eb0ed696c781
Dump complete
Byte counts: header=100 hot=7603292 discardable=135072 cold=3591048
Reloc counts: hot=428962 discardable=5173
larsi@giant:~/src/emacs/trunk$ ./src/emacs -Q --dump-file /tmp/emacs.pdmp 

But it seems to work fine there.  Are you still seeing this issue in
recent Emacs versions?

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





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2022-02-10  7:37 ` Lars Ingebrigtsen
@ 2022-02-19 23:51   ` Yuan Fu
  0 siblings, 0 replies; 14+ messages in thread
From: Yuan Fu @ 2022-02-19 23:51 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 39168

> 
> But it seems to work fine there.  Are you still seeing this issue in
> recent Emacs versions?

No. I tried and it works fine now. Closed this report. Many thanks for your work Lars!

Yuan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#39168: Fwd: bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags
  2020-01-18  4:26 bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags Yuan Fu
                   ` (2 preceding siblings ...)
  2022-02-10  7:37 ` Lars Ingebrigtsen
@ 2022-02-19 23:52 ` Yuan Fu
  3 siblings, 0 replies; 14+ messages in thread
From: Yuan Fu @ 2022-02-19 23:52 UTC (permalink / raw)
  To: 39168-done







^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-02-19 23:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-18  4:26 bug#39168: 27.0.50; Error on command line flags with use dump-file flag with other flags Yuan Fu
2020-01-18  9:03 ` Eli Zaretskii
2020-01-18 14:29   ` Yuan Fu
2020-01-18 15:23     ` Eli Zaretskii
2020-04-24 15:58 ` Yuan Fu
2020-04-24 16:31   ` Eli Zaretskii
2020-04-24 17:45     ` Yuan Fu
2020-04-24 18:05       ` Eli Zaretskii
2020-04-24 19:44         ` Yuan Fu
2020-04-24 20:24           ` Yuan Fu
2020-07-24  0:18             ` Yuan Fu
2022-02-10  7:37 ` Lars Ingebrigtsen
2022-02-19 23:51   ` Yuan Fu
2022-02-19 23:52 ` bug#39168: Fwd: " Yuan Fu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).