* [Buildroot] [PATCH] mtd-utils: ubinize: fix return code on error
@ 2016-04-11 15:58 Luca Ceresoli
2016-04-12 20:16 ` Arnout Vandecappelle
0 siblings, 1 reply; 3+ messages in thread
From: Luca Ceresoli @ 2016-04-11 15:58 UTC (permalink / raw)
To: buildroot
ubinize 1.5.2 (currently packaged in Buildroot) returns 0 in case of
some errors. This can lead to unnoticed errors in the middle of a
build.
Fix by adding a patch from upstream, which is not yet present in any
released verison.
Fetch from: http://git.infradead.org/mtd-utils.git/commit/5f50207231414bfdbac8f0f974a2824f24177d6e
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
---
...binize-Always-return-error-code-at-least-.patch | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
diff --git a/package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch b/package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
new file mode 100644
index 0000000..772ab78
--- /dev/null
+++ b/package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
@@ -0,0 +1,63 @@
+From 5f50207231414bfdbac8f0f974a2824f24177d6e Mon Sep 17 00:00:00 2001
+From: Enrico Jorns <ejo@pengutronix.de>
+Date: Fri, 11 Sep 2015 15:28:13 +0200
+Subject: [PATCH] mtd-utils: ubinize: Always return error code (at least -1) in
+ case of an error
+
+ubinize should not fail silenty, this can be very annoying when using
+it from other tools that rely on the exit code for determining the
+success of their operation.
+
+Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+---
+ ubi-utils/ubinize.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/ubi-utils/ubinize.c b/ubi-utils/ubinize.c
+index 34f465a..60bbd9a 100644
+--- a/ubi-utils/ubinize.c
++++ b/ubi-utils/ubinize.c
+@@ -519,6 +519,7 @@ int main(int argc, char * const argv[])
+ */
+ seek = ui.peb_size * 2;
+ if (lseek(args.out_fd, seek, SEEK_SET) != seek) {
++ err = -1;
+ sys_errmsg("cannot seek file \"%s\"", args.f_out);
+ goto out_free;
+ }
+@@ -530,6 +531,7 @@ int main(int argc, char * const argv[])
+ int fd, j;
+
+ if (!sname) {
++ err = -1;
+ errmsg("ini-file parsing error (iniparser_getsecname)");
+ goto out_free;
+ }
+@@ -550,6 +552,7 @@ int main(int argc, char * const argv[])
+ */
+ for (j = 0; j < i; j++) {
+ if (vi[i].id == vi[j].id) {
++ err = -1;
+ errmsg("volume IDs must be unique, but ID %d "
+ "in section \"%s\" is not",
+ vi[i].id, sname);
+@@ -557,6 +560,7 @@ int main(int argc, char * const argv[])
+ }
+
+ if (!strcmp(vi[i].name, vi[j].name)) {
++ err = -1;
+ errmsg("volume name must be unique, but name "
+ "\"%s\" in section \"%s\" is not",
+ vi[i].name, sname);
+@@ -580,6 +584,7 @@ int main(int argc, char * const argv[])
+ if (img) {
+ fd = open(img, O_RDONLY);
+ if (fd == -1) {
++ err = fd;
+ sys_errmsg("cannot open \"%s\"", img);
+ goto out_free;
+ }
+--
+1.9.1
+
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] mtd-utils: ubinize: fix return code on error
2016-04-11 15:58 [Buildroot] [PATCH] mtd-utils: ubinize: fix return code on error Luca Ceresoli
@ 2016-04-12 20:16 ` Arnout Vandecappelle
2016-04-12 23:09 ` Luca Ceresoli
0 siblings, 1 reply; 3+ messages in thread
From: Arnout Vandecappelle @ 2016-04-12 20:16 UTC (permalink / raw)
To: buildroot
Hi Luca,
On 04/11/16 17:58, Luca Ceresoli wrote:
> ubinize 1.5.2 (currently packaged in Buildroot) returns 0 in case of
> some errors. This can lead to unnoticed errors in the middle of a
> build.
>
> Fix by adding a patch from upstream, which is not yet present in any
> released verison.
>
> Fetch from: http://git.infradead.org/mtd-utils.git/commit/5f50207231414bfdbac8f0f974a2824f24177d6e
>
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> ---
> ...binize-Always-return-error-code-at-least-.patch | 63 ++++++++++++++++++++++
> 1 file changed, 63 insertions(+)
> create mode 100644 package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
>
> diff --git a/package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch b/package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
> new file mode 100644
> index 0000000..772ab78
> --- /dev/null
> +++ b/package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
> @@ -0,0 +1,63 @@
> +From 5f50207231414bfdbac8f0f974a2824f24177d6e Mon Sep 17 00:00:00 2001
> +From: Enrico Jorns <ejo@pengutronix.de>
> +Date: Fri, 11 Sep 2015 15:28:13 +0200
> +Subject: [PATCH] mtd-utils: ubinize: Always return error code (at least -1) in
> + case of an error
> +
> +ubinize should not fail silenty, this can be very annoying when using
> +it from other tools that rely on the exit code for determining the
> +success of their operation.
> +
> +Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
> +Signed-off-by: Brian Norris <computersforpeace@gmail.com>
You forgot to add you SoB.
Otherwise looks good to me.
Regards,
Arnout
> +---
> + ubi-utils/ubinize.c | 5 +++++
> + 1 file changed, 5 insertions(+)
> +
> +diff --git a/ubi-utils/ubinize.c b/ubi-utils/ubinize.c
> +index 34f465a..60bbd9a 100644
> +--- a/ubi-utils/ubinize.c
> ++++ b/ubi-utils/ubinize.c
> +@@ -519,6 +519,7 @@ int main(int argc, char * const argv[])
> + */
> + seek = ui.peb_size * 2;
> + if (lseek(args.out_fd, seek, SEEK_SET) != seek) {
> ++ err = -1;
> + sys_errmsg("cannot seek file \"%s\"", args.f_out);
> + goto out_free;
> + }
> +@@ -530,6 +531,7 @@ int main(int argc, char * const argv[])
> + int fd, j;
> +
> + if (!sname) {
> ++ err = -1;
> + errmsg("ini-file parsing error (iniparser_getsecname)");
> + goto out_free;
> + }
> +@@ -550,6 +552,7 @@ int main(int argc, char * const argv[])
> + */
> + for (j = 0; j < i; j++) {
> + if (vi[i].id == vi[j].id) {
> ++ err = -1;
> + errmsg("volume IDs must be unique, but ID %d "
> + "in section \"%s\" is not",
> + vi[i].id, sname);
> +@@ -557,6 +560,7 @@ int main(int argc, char * const argv[])
> + }
> +
> + if (!strcmp(vi[i].name, vi[j].name)) {
> ++ err = -1;
> + errmsg("volume name must be unique, but name "
> + "\"%s\" in section \"%s\" is not",
> + vi[i].name, sname);
> +@@ -580,6 +584,7 @@ int main(int argc, char * const argv[])
> + if (img) {
> + fd = open(img, O_RDONLY);
> + if (fd == -1) {
> ++ err = fd;
> + sys_errmsg("cannot open \"%s\"", img);
> + goto out_free;
> + }
> +--
> +1.9.1
> +
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] mtd-utils: ubinize: fix return code on error
2016-04-12 20:16 ` Arnout Vandecappelle
@ 2016-04-12 23:09 ` Luca Ceresoli
0 siblings, 0 replies; 3+ messages in thread
From: Luca Ceresoli @ 2016-04-12 23:09 UTC (permalink / raw)
To: buildroot
Dear Arnout,
On 12/04/2016 22:16, Arnout Vandecappelle wrote:
>
> Hi Luca,
>
> On 04/11/16 17:58, Luca Ceresoli wrote:
>> ubinize 1.5.2 (currently packaged in Buildroot) returns 0 in case of
>> some errors. This can lead to unnoticed errors in the middle of a
>> build.
>>
>> Fix by adding a patch from upstream, which is not yet present in any
>> released verison.
>>
>> Fetch from:
>> http://git.infradead.org/mtd-utils.git/commit/5f50207231414bfdbac8f0f974a2824f24177d6e
>>
>>
>> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
>> ---
>> ...binize-Always-return-error-code-at-least-.patch | 63
>> ++++++++++++++++++++++
>> 1 file changed, 63 insertions(+)
>> create mode 100644
>> package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
>>
>>
>> diff --git
>> a/package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
>> b/package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
>>
>> new file mode 100644
>> index 0000000..772ab78
>> --- /dev/null
>> +++
>> b/package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
>>
>> @@ -0,0 +1,63 @@
>> +From 5f50207231414bfdbac8f0f974a2824f24177d6e Mon Sep 17 00:00:00 2001
>> +From: Enrico Jorns <ejo@pengutronix.de>
>> +Date: Fri, 11 Sep 2015 15:28:13 +0200
>> +Subject: [PATCH] mtd-utils: ubinize: Always return error code (at
>> least -1) in
>> + case of an error
>> +
>> +ubinize should not fail silenty, this can be very annoying when using
>> +it from other tools that rely on the exit code for determining the
>> +success of their operation.
>> +
>> +Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
>> +Signed-off-by: Brian Norris <computersforpeace@gmail.com>
>
> You forgot to add you SoB.
My bad... v2 on the way!
>
> Otherwise looks good to me.
Thanks.
--
Luca
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-12 23:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-11 15:58 [Buildroot] [PATCH] mtd-utils: ubinize: fix return code on error Luca Ceresoli
2016-04-12 20:16 ` Arnout Vandecappelle
2016-04-12 23:09 ` Luca Ceresoli
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.