* [ptxdist] [PATCH 1/2] wpan-tools: version bump 0.4 -> 0.5 @ 2015-08-23 13:56 Alexander Aring 2015-08-23 13:56 ` [ptxdist] [PATCH 2/2] genimage: add workaround to work with glibc 2.22 Alexander Aring 0 siblings, 1 reply; 3+ messages in thread From: Alexander Aring @ 2015-08-23 13:56 UTC (permalink / raw) To: ptxdist; +Cc: Alexander Aring Signed-off-by: Alexander Aring <alex.aring@gmail.com> --- rules/wpan-tools.make | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rules/wpan-tools.make b/rules/wpan-tools.make index 480d151..ddd882e 100644 --- a/rules/wpan-tools.make +++ b/rules/wpan-tools.make @@ -16,8 +16,8 @@ PACKAGES-$(PTXCONF_WPAN_TOOLS) += wpan-tools # # Paths and names # -WPAN_TOOLS_VERSION := 0.4 -WPAN_TOOLS_MD5 := 7dec36cec484cf4cbfb717536bd7aa83 +WPAN_TOOLS_VERSION := 0.5 +WPAN_TOOLS_MD5 := c6356f7be4de2e9f2084283b9ed7e1ab WPAN_TOOLS := wpan-tools-$(WPAN_TOOLS_VERSION) WPAN_TOOLS_SUFFIX := tar.gz WPAN_TOOLS_URL := http://wpan.cakelab.org/releases/$(WPAN_TOOLS).$(WPAN_TOOLS_SUFFIX) @@ -49,6 +49,7 @@ $(STATEDIR)/wpan-tools.targetinstall: @$(call install_fixup, wpan-tools,DESCRIPTION,missing) @$(call install_copy, wpan-tools, 0, 0, 0755, -, /usr/bin/iwpan) + @$(call install_copy, wpan-tools, 0, 0, 0755, -, /usr/bin/wpan-ping) @$(call install_finish, wpan-tools) -- 2.5.0 -- ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 3+ messages in thread
* [ptxdist] [PATCH 2/2] genimage: add workaround to work with glibc 2.22 2015-08-23 13:56 [ptxdist] [PATCH 1/2] wpan-tools: version bump 0.4 -> 0.5 Alexander Aring @ 2015-08-23 13:56 ` Alexander Aring 2015-08-25 12:41 ` Alexander Aring 0 siblings, 1 reply; 3+ messages in thread From: Alexander Aring @ 2015-08-23 13:56 UTC (permalink / raw) To: ptxdist; +Cc: Alexander Aring This patch adds a workaround for check if value argument of setenv is null. In all glibc versions setenv(..., NULL, ...) ends in an undef behaviour, since glibc 2.22 it will end in a core dump. This is a workaround because it adds to every setenv a null check. I think some setenv are optional and some need to be set like name. Maybe we should make then a clear upstream patch which checks on this. I currently don't know which setenv is optional and which not. In my case of creating vfat image it seems some of them are optional like IMAGEMOUNTPOINT. Signed-off-by: Alexander Aring <alex.aring@gmail.com> --- ...ge-add-wrapper-for-handling-setenv-.-NULL.patch | 68 ++++++++++++++++++++++ patches/genimage-7/series | 4 ++ 2 files changed, 72 insertions(+) create mode 100644 patches/genimage-7/0001-genimage-add-wrapper-for-handling-setenv-.-NULL.patch create mode 100644 patches/genimage-7/series diff --git a/patches/genimage-7/0001-genimage-add-wrapper-for-handling-setenv-.-NULL.patch b/patches/genimage-7/0001-genimage-add-wrapper-for-handling-setenv-.-NULL.patch new file mode 100644 index 0000000..79a2c3e --- /dev/null +++ b/patches/genimage-7/0001-genimage-add-wrapper-for-handling-setenv-.-NULL.patch @@ -0,0 +1,68 @@ +From: Alexander Aring <alex.aring@gmail.com> +Date: Sun, 23 Aug 2015 13:17:38 +0200 +Subject: [PATCH] genimage: add wrapper for handling setenv(..., NULL, ...) + +This patch adds a wrapper when calling setenv(..., NULL, ...) to a +no-op. Since glibc 2.22 this will end in a core dump. + +Signed-off-by: Alexander Aring <alex.aring@gmail.com> +--- + genimage.c | 29 ++++++++++++++++++++--------- + 1 file changed, 20 insertions(+), 9 deletions(-) + +diff --git a/genimage.c b/genimage.c +index e80127a2fbb9..9f60cc092eb4 100644 +--- a/genimage.c ++++ b/genimage.c +@@ -239,6 +239,17 @@ static int image_generate(struct image *image) + return 0; + } + ++/* ++ * Simple wrapper for setenv which doesn't run setenv if value == NULL ++ */ ++static int image_setenv(const char *name, const char *value, int overwrite) ++{ ++ if (!value) ++ return 0; ++ else ++ return setenv(name, value, overwrite); ++} ++ + static LIST_HEAD(flashlist); + + static int parse_flashes(cfg_t *cfg) +@@ -598,10 +609,10 @@ int main(int argc, char *argv[]) + if (ret) + goto err_out; + } +- setenv("OUTPUTPATH", imagepath(), 1); +- setenv("INPUTPATH", inputpath(), 1); +- setenv("ROOTPATH", rootpath(), 1); +- setenv("TMPPATH", tmppath(), 1); ++ image_setenv("OUTPUTPATH", imagepath(), 1); ++ image_setenv("INPUTPATH", inputpath(), 1); ++ image_setenv("ROOTPATH", rootpath(), 1); ++ image_setenv("TMPPATH", tmppath(), 1); + + ret = systemp(NULL, "mkdir -p %s", imagepath()); + if (ret) +@@ -613,13 +624,13 @@ int main(int argc, char *argv[]) + + list_for_each_entry(image, &images, list) { + char *sizestr; +- setenv("IMAGE", image->file, 1); +- setenv("IMAGEOUTFILE", imageoutfile(image), 1); +- setenv("IMAGENAME", image->name, 1); ++ image_setenv("IMAGE", image->file, 1); ++ image_setenv("IMAGEOUTFILE", imageoutfile(image), 1); ++ image_setenv("IMAGENAME", image->name, 1); + asprintf(&sizestr, "%lld", image->size); +- setenv("IMAGESIZE", sizestr, 1); ++ image_setenv("IMAGESIZE", sizestr, 1); + free(sizestr); +- setenv("IMAGEMOUNTPOINT", image->mountpoint, 1); ++ image_setenv("IMAGEMOUNTPOINT", image->mountpoint, 1); + ret = image_generate(image); + if (ret) { + image_error(image, "failed to generate %s\n", image->file); diff --git a/patches/genimage-7/series b/patches/genimage-7/series new file mode 100644 index 0000000..7e934ff --- /dev/null +++ b/patches/genimage-7/series @@ -0,0 +1,4 @@ +# generated by git-ptx-patches +#tag:base --start-number 1 +0001-genimage-add-wrapper-for-handling-setenv-.-NULL.patch +# 1d1a2661aa1e8827ec74d7a3aa9b9793 - git-ptx-patches magic -- 2.5.0 -- ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ptxdist] [PATCH 2/2] genimage: add workaround to work with glibc 2.22 2015-08-23 13:56 ` [ptxdist] [PATCH 2/2] genimage: add workaround to work with glibc 2.22 Alexander Aring @ 2015-08-25 12:41 ` Alexander Aring 0 siblings, 0 replies; 3+ messages in thread From: Alexander Aring @ 2015-08-25 12:41 UTC (permalink / raw) To: ptxdist On Sun, Aug 23, 2015 at 03:56:58PM +0200, Alexander Aring wrote: > This patch adds a workaround for check if value argument of setenv is > null. In all glibc versions setenv(..., NULL, ...) ends in an undef > behaviour, since glibc 2.22 it will end in a core dump. > > This is a workaround because it adds to every setenv a null check. I > think some setenv are optional and some need to be set like name. Maybe > we should make then a clear upstream patch which checks on this. I > currently don't know which setenv is optional and which not. In my case > of creating vfat image it seems some of them are optional like > IMAGEMOUNTPOINT. > > Signed-off-by: Alexander Aring <alex.aring@gmail.com> > --- > ...ge-add-wrapper-for-handling-setenv-.-NULL.patch | 68 ++++++++++++++++++++++ > patches/genimage-7/series | 4 ++ > 2 files changed, 72 insertions(+) > create mode 100644 patches/genimage-7/0001-genimage-add-wrapper-for-handling-setenv-.-NULL.patch > create mode 100644 patches/genimage-7/series > > diff --git a/patches/genimage-7/0001-genimage-add-wrapper-for-handling-setenv-.-NULL.patch b/patches/genimage-7/0001-genimage-add-wrapper-for-handling-setenv-.-NULL.patch > new file mode 100644 > index 0000000..79a2c3e > --- /dev/null > +++ b/patches/genimage-7/0001-genimage-add-wrapper-for-handling-setenv-.-NULL.patch > @@ -0,0 +1,68 @@ > +From: Alexander Aring <alex.aring@gmail.com> > +Date: Sun, 23 Aug 2015 13:17:38 +0200 > +Subject: [PATCH] genimage: add wrapper for handling setenv(..., NULL, ...) > + > +This patch adds a wrapper when calling setenv(..., NULL, ...) to a > +no-op. Since glibc 2.22 this will end in a core dump. > + > +Signed-off-by: Alexander Aring <alex.aring@gmail.com> > +--- > + genimage.c | 29 ++++++++++++++++++++--------- > + 1 file changed, 20 insertions(+), 9 deletions(-) > + > +diff --git a/genimage.c b/genimage.c > +index e80127a2fbb9..9f60cc092eb4 100644 > +--- a/genimage.c > ++++ b/genimage.c > +@@ -239,6 +239,17 @@ static int image_generate(struct image *image) > + return 0; > + } > + > ++/* > ++ * Simple wrapper for setenv which doesn't run setenv if value == NULL > ++ */ > ++static int image_setenv(const char *name, const char *value, int overwrite) > ++{ > ++ if (!value) > ++ return 0; > ++ else > ++ return setenv(name, value, overwrite); > ++} This sould be: static inline int image_setenv(const char *name, const char *value, int overwrite) { return setenv(name, value ? value : "", overwrite); } Current solution is 100% broken if generating multiple images in the below list_for_each_entry loop it will not overwrite the previous setting. > ++ > + static LIST_HEAD(flashlist); > + > + static int parse_flashes(cfg_t *cfg) > +@@ -598,10 +609,10 @@ int main(int argc, char *argv[]) > + if (ret) > + goto err_out; > + } > +- setenv("OUTPUTPATH", imagepath(), 1); > +- setenv("INPUTPATH", inputpath(), 1); > +- setenv("ROOTPATH", rootpath(), 1); > +- setenv("TMPPATH", tmppath(), 1); > ++ image_setenv("OUTPUTPATH", imagepath(), 1); > ++ image_setenv("INPUTPATH", inputpath(), 1); > ++ image_setenv("ROOTPATH", rootpath(), 1); > ++ image_setenv("TMPPATH", tmppath(), 1); > + > + ret = systemp(NULL, "mkdir -p %s", imagepath()); > + if (ret) > +@@ -613,13 +624,13 @@ int main(int argc, char *argv[]) > + > + list_for_each_entry(image, &images, list) { I mean this loop here. > + char *sizestr; > +- setenv("IMAGE", image->file, 1); > +- setenv("IMAGEOUTFILE", imageoutfile(image), 1); > +- setenv("IMAGENAME", image->name, 1); > ++ image_setenv("IMAGE", image->file, 1); > ++ image_setenv("IMAGEOUTFILE", imageoutfile(image), 1); > ++ image_setenv("IMAGENAME", image->name, 1); > + asprintf(&sizestr, "%lld", image->size); > +- setenv("IMAGESIZE", sizestr, 1); > ++ image_setenv("IMAGESIZE", sizestr, 1); > + free(sizestr); > +- setenv("IMAGEMOUNTPOINT", image->mountpoint, 1); > ++ image_setenv("IMAGEMOUNTPOINT", image->mountpoint, 1); > + ret = image_generate(image); > + if (ret) { > + image_error(image, "failed to generate %s\n", image->file); I will not send a v2 until mol's opinion according to that solution. - Alex -- ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-25 12:41 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-08-23 13:56 [ptxdist] [PATCH 1/2] wpan-tools: version bump 0.4 -> 0.5 Alexander Aring 2015-08-23 13:56 ` [ptxdist] [PATCH 2/2] genimage: add workaround to work with glibc 2.22 Alexander Aring 2015-08-25 12:41 ` Alexander Aring
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox