From: Tomáš Virtus Date: Mon, 3 Feb 2020 12:31:27 +0000 (+0100) Subject: Fix duplicate Syslinux entries X-Git-Tag: v0.18.0~9^2~2 X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=commitdiff_plain;h=f0e3c9362fe714123e8090207b382ceec0a87416 Fix duplicate Syslinux entries Documentation of open()[1] says: Other common values ... and 'a' for appending (which on some Unix systems, means that all writes append to the end of the file regardless of the current seek position). On my system (Linux 5.4), writes to a file opened as 'a+' go at the end. [1] https://docs.python.org/3/library/functions.html#open --- diff --git a/grml2usb b/grml2usb index c53f58b..5a94e10 100755 --- a/grml2usb +++ b/grml2usb @@ -1323,7 +1323,7 @@ def add_entry_if_not_present(filename, entry): @filename: name of the file @entry: data to write to the file """ - data = open(filename, "a+") + data = open(filename, "r+") for line in data: if line == entry: break