* [PATCH v2] lib/oe/utils: add eol to format_pkg_list()
@ 2018-10-04 5:29 grygorii tertychnyi
2018-10-04 17:03 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: grygorii tertychnyi @ 2018-10-04 5:29 UTC (permalink / raw)
To: openembedded-core; +Cc: xe-linux-external
Append '\n' to the non-empty formatted string before return. If you
write it to the (manifest) file, it will ensure file ends with a newline.
Many GNU utilities have problems processing the last line of a file
if it is not '\n' terminated. E.g. if the last line is not terminated
by a newline character, then "read" will read it but return false,
leaving the broken partial line in the read variable(s).
It can also break or adversely affect some text processing tools,
that operate on the file.
Signed-off-by: grygorii tertychnyi <gtertych@cisco.com>
---
Changes in v2:
o make sure we don't append '\n' to the empty string
meta/lib/oe/utils.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 93b0763b0a..d05f517a70 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -347,7 +347,13 @@ def format_pkg_list(pkg_dict, ret_format=None):
for pkg in sorted(pkg_dict):
output.append(pkg)
- return '\n'.join(output)
+ output_str = '\n'.join(output)
+
+ if output_str:
+ # make sure last line is newline terminated
+ output_str += '\n'
+
+ return output_str
def host_gcc_version(d, taskcontextonly=False):
import re, subprocess
--
2.19.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] lib/oe/utils: add eol to format_pkg_list()
2018-10-04 5:29 [PATCH v2] lib/oe/utils: add eol to format_pkg_list() grygorii tertychnyi
@ 2018-10-04 17:03 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2018-10-04 17:03 UTC (permalink / raw)
To: grygorii tertychnyi, openembedded-core; +Cc: xe-linux-external
On Thu, 2018-10-04 at 08:29 +0300, grygorii tertychnyi via
Openembedded-core wrote:
> Append '\n' to the non-empty formatted string before return. If you
> write it to the (manifest) file, it will ensure file ends with a
> newline.
>
> Many GNU utilities have problems processing the last line of a file
> if it is not '\n' terminated. E.g. if the last line is not terminated
> by a newline character, then "read" will read it but return false,
> leaving the broken partial line in the read variable(s).
> It can also break or adversely affect some text processing tools,
> that operate on the file.
>
> Signed-off-by: grygorii tertychnyi <gtertych@cisco.com>
> ---
>
> Changes in v2:
> o make sure we don't append '\n' to the empty string
This still breaks things which doesn't give me much confidence in this
change for 2.6 :(.
https://autobuilder.yoctoproject.org/typhoon/#/builders/28/builds/90/st
eps/7/logs/step2d
https://autobuilder.yoctoproject.org/typhoon/#/builders/24/builds/87/st
eps/7/logs/step4b
and more...
Cheers,
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-04 17:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04 5:29 [PATCH v2] lib/oe/utils: add eol to format_pkg_list() grygorii tertychnyi
2018-10-04 17:03 ` Richard Purdie
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.