After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720087 - non-portable use of 'sed -i' in libsecret Makefile.am
non-portable use of 'sed -i' in libsecret Makefile.am
Status: RESOLVED FIXED
Product: libsecret
Classification: Other
Component: General
unspecified
Other All
: Normal normal
: ---
Assigned To: libsecret maintainer(s)
libsecret maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-12-09 00:34 UTC by Allison Karlitskaya (desrt)
Modified: 2014-08-12 06:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
libsecret: more sed portability changes (1.08 KB, patch)
2013-12-11 14:51 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2013-12-09 00:34:05 UTC
sed -i is not POSIX

secret-dbus-generated.c: $(DBUS_XML_DEFINITIONS) Makefile.am
        $(AM_V_GEN) gdbus-codegen --interface-prefix org.freedesktop.Secret. \
                --generate-c-code secret-dbus-generated --c-namespace SecretGen \
                $(DBUS_XML_DEFINITIONS)
        $(AM_V_GEN) sed -i -e 's/secret_gen_/_secret_gen_/g' -e 's/type-/type/g' secret-dbus-generated.[ch]
        $(AM_V_GEN) sed -i -e '1i #define GLIB_DISABLE_DEPRECATION_WARNINGS' secret-dbus-generated.c
secret-dbus-generated.h: secret-dbus-generated.c
Comment 1 Allison Karlitskaya (desrt) 2013-12-09 00:46:45 UTC
This rule is also dangerous because of how it creates the target even in the case of failure -- causing a rerun of 'make' to use the incorrect result.

Probably the best thing to do here is to generate a tmp file and use non-inplace sed to move it to another tmp file which you can then atomically 'mv' into its final name.

Either that, or you could figure out a way to avoid the whole mess...

As for the #define, you could always just use -D... (although, I guess the point of this is that you only want that for one file...).  Our policy these days anyway is that you shouldn't dist these files, so they should always build without warning (because they were generated by the same version of gdbus-codegen as the GLib you're using).  nodist_*_SOURCES = helps...
Comment 2 Stef Walter 2013-12-11 10:00:28 UTC
Pushed a fix to git master.
Comment 3 Allison Karlitskaya (desrt) 2013-12-11 14:51:29 UTC
Created attachment 263984 [details] [review]
libsecret: more sed portability changes

As per POSIX, a '\' and a newline is expected after the 'i' command.
Comment 4 Antoine Jacoutot 2013-12-14 08:21:11 UTC
Review of attachment 263984 [details] [review]:

With this additional patch I can confirm it is working fine with OpenBSD sed(1).
Comment 5 Stef Walter 2014-01-02 17:39:37 UTC
Comment on attachment 263984 [details] [review]
libsecret: more sed portability changes

Looks good. Thanks!
Comment 6 Allison Karlitskaya (desrt) 2014-01-02 17:48:34 UTC
Comment on attachment 263984 [details] [review]
libsecret: more sed portability changes

Looks like you pushed it for me :)
Comment 7 Stef Walter 2014-08-12 06:06:12 UTC
*** Bug 734630 has been marked as a duplicate of this bug. ***