Bug 13717 - file_lines_parse() utility function drops last line if no trailing newline
Summary: file_lines_parse() utility function drops last line if no trailing newline
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: 4.9.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-17 01:18 UTC by Martin Schwenke
Modified: 2019-01-10 12:42 UTC (History)
3 users (show)

See Also:


Attachments
Patch for 4.8, 4.9 (5.96 KB, patch)
2018-12-19 11:20 UTC, Martin Schwenke
abartlet: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Schwenke 2018-12-17 01:18:53 UTC
file_lines_parse() only recognises lines that end in a newline character.

If a configuration file is edited using an editor that does not insist on the trailing newline (e.g. Emacs) then the last line can be ignored.  An example of this is the CTDB public addresses file.  I noticed this after seeing the following update to the wiki:

  https://wiki.samba.org/index.php?title=Adding_public_IP_addresses&type=revision&diff=14981&oldid=14715
Comment 1 Martin Schwenke 2018-12-19 11:20:28 UTC
Created attachment 14745 [details]
Patch for 4.8, 4.9

Patch applies to both v4-8-test and v4-9-test, compiles, "bin/smbtorture x local.file" runs successfully.

Do we need to put this though private autobuilds before asking Karolin to apply it to v4-8-test and v4-9-test?  I can't imagine it causing any failures anywhere...
Comment 2 Andrew Bartlett 2018-12-19 17:15:26 UTC
It isn't yet team procedure to open merge requests or do private autobuilds for backports, but I've started doing for the same reason as for getting the original patches into master:  That CI is (comparatively) cheap and if it saves a round-trip then it is a good thing.
Comment 3 Martin Schwenke 2019-01-08 03:35:07 UTC
Hi Andrew,

Just confirming that you're happy for this to go into 4.8 and 4.9?

Karolin, hasn't taken this yet, so wanted to make sure...  :-)
Comment 4 Karolin Seeger 2019-01-08 12:07:05 UTC
(In reply to Martin Schwenke from comment #3)
Pushed to autobuild-v4-{8,9}-test.
Comment 5 Karolin Seeger 2019-01-10 12:42:34 UTC
(In reply to Karolin Seeger from comment #4)
Pushed to both branches.
Closing out bug report.

Thanks!