emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master a9b393c: Include development data in --version output


From: Eli Zaretskii
Subject: Re: master a9b393c: Include development data in --version output
Date: Wed, 01 Jun 2022 22:10:23 +0300

> commit a9b393c77350cc177952008707781dd97341a83a
> Author:     Lars Ingebrigtsen <larsi@gnus.org>
> AuthorDate: Mon May 23 11:58:22 2022 +0200
> Commit:     Lars Ingebrigtsen <larsi@gnus.org>
> CommitDate: Mon May 23 11:58:22 2022 +0200
> 
>     Include development data in --version output
>     
>     * src/emacs.c (main): Include development into in --version output
>     (bug#38657).
> 
> diff --git a/src/emacs.c b/src/emacs.c
> index 056cebb..fed525f 100644
> --- a/src/emacs.c
> +++ b/src/emacs.c
> @@ -1449,14 +1449,29 @@ main (int argc, char **argv)
>         version = emacs_version;
>         copyright = emacs_copyright;
>       }
> -      printf (("%s %s\n"
> -            "%s\n"
> +      printf ("%s %s\n", PACKAGE_NAME, version);
> +      {
> +     Lisp_Object rversion =
> +       Fsymbol_value (intern_c_string ("emacs-repository-version"));
> +     Lisp_Object rbranch =
> +       Fsymbol_value (intern_c_string ("emacs-repository-branch"));
> +     Lisp_Object rtime =
> +       Fsymbol_value (intern_c_string ("emacs-build-time"));
> +     if (!NILP (rversion) && !NILP (rbranch) && !NILP (rtime))
> +       printf ("Development version %s on %s branch; build date %s.\n",
> +               SSDATA (Fsubstring (rversion, make_fixnum (0),
> +                                   make_fixnum (12))),
> +               SSDATA (rbranch),
> +               SSDATA (Fformat_time_string (build_string ("%Y-%m-%d"),
> +                                            rtime, Qnil)));
> +      }
> +      printf (("%s\n"
>              "%s comes with ABSOLUTELY NO WARRANTY.\n"
>              "You may redistribute copies of %s\n"
>              "under the terms of the GNU General Public License.\n"
>              "For more information about these matters, "
>              "see the file named COPYING.\n"),
> -           PACKAGE_NAME, version, copyright, PACKAGE_NAME, PACKAGE_NAME);
> +           copyright, PACKAGE_NAME, PACKAGE_NAME);
>        exit (0);
>      }
 
This change caused Emacs to crash when invoked with --version on
MS-Windows.  The reason was that it calls format-time-string, which
calls GMP functions, and that cannot be safely done before invoking
init_bignum.

I fixed the crash, but I cannot say that I'm happy with how this is
implemented: it is not safe to call Lisp functions so early into the
startup, before all the gazillion of init_FOO initializations were
called and did their things.  Look how the next Lisp function call is
waaaay down the 'main', _after_ the initializations.

I think this code fragment is a bomb waiting to go off.  We should IMO
instead raise a flag and then test it and act on it much later in the
code.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]