Re: [PATCH] build: ignore errors from `git describe`
Benno Schulenberg <[email protected]>
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <[email protected]> |
Op 09-06-2022 om 14:00 schreef LIU Hao:
> Since Git 2.35.2, a user who builds nano from Git as a normal user then installs
> it with `sudo make install` could get a blank version string in the titlebar.
Yes, I noticed this while making the last release, and worked around it quickly
as git suggested, so I haven't seen the problem since. But indeed, it's better
to avoid bothering the user with this. Thanks for the patch.
(Although... the built nano would then use the version number from config.h
if the user were to skip the plain 'make' step. Not too bad, but... not what
is intended either.)
> - @echo "#define $(SOMETHING)" | cmp -s $@ - || \
> + @! git describe 2>/dev/null || \
> + echo "#define $(SOMETHING)" | cmp -s $@ - || \
> echo "#define $(SOMETHING)" > $@
Redirecting only stderr interleaves the regular output of `git describe` (if any)
in the build output. Not harmful, but better not. So I suggest:
@! git describe >/dev/null 2>&1 || \
Are you okay with that change?
Benno
OpenPGP_signature
(application/pgp-signature, 840 B) - not displayed