Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 930086 - app-editors/emacs-29.3-r1: "make all" failed with exit status 2 with app-alternatives/sh[mksh] (app-shells/mksh)
Summary: app-editors/emacs-29.3-r1: "make all" failed with exit status 2 with app-alte...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: GNU Emacs project
URL:
Whiteboard:
Keywords: UPSTREAM
Depends on:
Blocks: nonbash
  Show dependency tree
 
Reported: 2024-04-15 22:44 UTC by Felix Janda
Modified: 2024-04-23 20:10 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,78.43 KB, text/plain)
2024-04-15 22:44 UTC, Felix Janda
Details
emerge --info (emerge.info,9.43 KB, text/plain)
2024-04-15 22:44 UTC, Felix Janda
Details
* build-aux/make-info-dir: Avoid bashism (bug#70484). (0001-build-aux-make-info-dir-Avoid-bashism-bug-70484.patch,840 bytes, patch)
2024-04-23 05:39 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Janda 2024-04-15 22:44:09 UTC
I am having trouble compiling emacs:

***
*** "make all" failed with exit status 2.
***
*** You could try to:
*** - run "make bootstrap", which might fix the problem
*** - run "make V=1", which displays the full commands invoked by make,
***   to further investigate the problem
***
make[1]: *** [Makefile:414: advice-on-failure] Error 2


Running "make V=1" gives a little more info:

/bin/mkdir -p ./info
(cd ./doc && \
 AWK='gawk' ../build-aux/make-info-dir ../build-aux/dir_top emacs/emacs.texi lispintro/emacs-lisp-intro.texi lispref/elisp.texi misc/auth.texi misc/autotype.texi misc/bovine.texi misc/calc.texi misc/cc-mode.texi misc/cl.texi misc/dbus.texi misc/dired-x.texi misc/ebrowse.texi misc/ede.texi misc/ediff.texi misc/edt.texi misc/efaq.texi misc/eglot.texi misc/eieio.texi misc/emacs-gnutls.texi misc/emacs-mime.texi misc/epa.texi misc/erc.texi misc/ert.texi misc/eshell.texi misc/eudc.texi misc/eww.texi misc/flymake.texi misc/forms.texi misc/gnus.texi misc/htmlfontify.texi misc/idlwave.texi misc/ido.texi misc/info.texi misc/mairix-el.texi misc/message.texi misc/mh-e.texi misc/modus-themes.org misc/newsticker.texi misc/nxml-mode.texi misc/octave-mode.texi misc/org.org misc/pcl-cvs.texi misc/pgg.texi misc/rcirc.texi misc/reftex.texi misc/remember.texi misc/sasl.texi misc/sc.texi misc/semantic.texi misc/ses.texi misc/sieve.texi misc/smtpmail.texi misc/speedbar.texi misc/srecode.texi misc/todo-mode.texi misc/tramp.texi misc/transient.texi misc/url.texi misc/use-package.texi misc/vhdl-mode.texi misc/vip.texi misc/viper.texi misc/vtable.texi misc/widget.texi misc/wisent.texi misc/woman.texi \
) >info/dir.tmp && mv info/dir.tmp info/dir
../build-aux/make-info-dir[104]: ${@?}: bad substitution
make[1]: *** [Makefile:1169: info/dir] Error 1

Reproducible: Always
Comment 1 Felix Janda 2024-04-15 22:44:26 UTC
Created attachment 890890 [details]
build.log
Comment 2 Felix Janda 2024-04-15 22:44:47 UTC
Created attachment 890891 [details]
emerge --info
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-04-15 23:01:36 UTC
```
) >info/dir.tmp && mv info/dir.tmp info/dir
../build-aux/make-info-dir[104]: ${@?}: bad substitution
```

Your emerge --info has `sh mksh 59c`.
Comment 4 Ulrich Müller gentoo-dev 2024-04-16 04:06:12 UTC
Looks like ${@?} or more generally ${PARAMETER?} is a bashism.
Can you report this upstream please?
Comment 5 Ulrich Müller gentoo-dev 2024-04-16 04:15:50 UTC
(In reply to Ulrich Müller from comment #4)
> Looks like ${@?} or more generally ${PARAMETER?} is a bashism.

Or maybe not. POSIX specifies it in https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02:

${parameter:?[word]}
    Indicate Error if Null or Unset. If parameter is unset or null, the expansion of word (or a message indicating it is unset if word is omitted) shall be written to standard error and the shell exits with a non-zero exit status. Otherwise, the value of parameter shall be substituted. An interactive shell need not exit.

In the parameter expansions shown previously, use of the <colon> in the format shall result in a test for a parameter that is unset or null; omission of the <colon> shall result in a test for a parameter that is only unset.
Comment 6 Felix Janda 2024-04-16 21:40:57 UTC
Thanks. I can confirm that it compiles successfully if I switch to bash.

Hope to take a closer look, and potentially report to upstream soon.
Comment 7 Haelwenn (lanodan) Monnier 2024-04-17 05:18:05 UTC
Indeed this looks like an mksh bug where even it's own manpage mentions "${name:?word}".

None of the following, either interactively or in a shell script works:
echo "${@?}"
echo "${@?empty}"
echo "${@:?}"
echo "${@:?empty}"

Meanwhile those works so likely due to $@ being a very special case:
echo "${HOME:?empty}"
echo "${HOME?empty}"
echo "${HOM?empty}"
echo "${HOM?}"
Comment 8 mirabilos 2024-04-18 13:19:43 UTC
mksh developer here.

POSIX (Issue 8d4) specifically prefixes with…

| If _parameter_ is '*' or '@', the result of the expansion is unspecified.

… the section about ${parameter{-,=,?,+}word}, documents the same inline for ${#parameter}, and the same plus '#' for ${parameter{%,%%,#,##}word}.

And in mksh, you cannot assign or trim a vector, so the expansion results in an error. Conforming scripts may not use it anyway.

Upstream should just check $# instead.
Comment 9 Ulrich Müller gentoo-dev 2024-04-18 15:01:10 UTC
(In reply to mirabilos from comment #8)
> POSIX (Issue 8d4) specifically prefixes with…
> 
> | If _parameter_ is '*' or '@', the result of the expansion is unspecified.
> 
> … the section about ${parameter{-,=,?,+}word}, documents the same inline for
> ${#parameter}, and the same plus '#' for ${parameter{%,%%,#,##}word}.

AFAICS the condition about its being unspecified with * or @ applies to ${#parameter} and ${parameter{%,%%,#,##}word}.

However, I don't see it in the paragraph about ${parameter{-,=,?,+}word} (then again, the wording of that section is somewhat confusing, so maybe I am missing something).

> Upstream should just check $# instead.

I tend to agree. :)
Comment 10 Ulrich Müller gentoo-dev 2024-04-18 15:02:31 UTC
(In reply to Ulrich Müller from comment #4)
> Can you report this upstream please?

@Felix Janda: Please do (GNU Emacs upstream, that is).
Comment 11 mirabilos 2024-04-18 16:44:55 UTC
> AFAICS the condition about its being unspecified with * or @ applies to ${#parameter} and
> ${parameter{%,%%,#,##}word}.

That was in Issue 7. In Issue 8, it’s been deliberately changed: * and @ only for {-,=,?,+} and ${#var}, * and @ and # for {%,%%,#,##}.

That doesn’t mean that GNU Emacs should use it now before Issue 8 is fully released (expected sometime this year, basically “RSN”).
Comment 12 Felix Janda 2024-04-21 19:32:09 UTC
I've reported the bug upstream: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70484
Comment 13 Ulrich Müller gentoo-dev 2024-04-23 05:39:27 UTC
Created attachment 891424 [details, diff]
* build-aux/make-info-dir: Avoid bashism (bug#70484).

Does Emacs build with mksh when you apply attached patch?
Comment 14 Felix Janda 2024-04-23 18:23:14 UTC
Tg(In reply to Ulrich Müller from comment #13)
> Created attachment 891424 [details, diff] [details, diff]
> * build-aux/make-info-dir: Avoid bashism (bug#70484).
> 
> Does Emacs build with mksh when you apply attached patch?

That works, thanks.
Comment 15 Larry the Git Cow gentoo-dev 2024-04-23 20:09:55 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/emacs-patches.git/commit/?id=d844a2770af0f7ea9de097401f81c0b5e8282ee4

commit d844a2770af0f7ea9de097401f81c0b5e8282ee4
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2024-04-23 19:47:21 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2024-04-23 19:47:21 +0000

    26.3, 27.2, 28.2, 29.3: Fix build with mksh
    
    Bug: https://bugs.gentoo.org/930086
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 emacs/26.3/10_all_make-info-dir.patch | 29 +++++++++++++++++++++++++++++
 emacs/27.2/12_all_make-info-dir.patch | 29 +++++++++++++++++++++++++++++
 emacs/29.3/04_all_make-info-dir.patch | 29 +++++++++++++++++++++++++++++
 3 files changed, 87 insertions(+)
Comment 16 Larry the Git Cow gentoo-dev 2024-04-23 20:10:14 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f209f6283f44692afafea6933296fb65730bd465

commit f209f6283f44692afafea6933296fb65730bd465
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2024-04-23 20:08:32 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2024-04-23 20:10:06 +0000

    app-editors/emacs: Fix build with mksh, fix for autoconf-2.72
    
    Closes: https://bugs.gentoo.org/930502
    Closes: https://bugs.gentoo.org/930086
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 app-editors/emacs/Manifest              |   4 +
 app-editors/emacs/emacs-26.3-r18.ebuild | 379 +++++++++++++++++++
 app-editors/emacs/emacs-27.2-r16.ebuild | 445 +++++++++++++++++++++++
 app-editors/emacs/emacs-28.2-r12.ebuild | 540 +++++++++++++++++++++++++++
 app-editors/emacs/emacs-29.3-r2.ebuild  | 627 ++++++++++++++++++++++++++++++++
 5 files changed, 1995 insertions(+)