From f0e3c9362fe714123e8090207b382ceec0a87416 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tom=C3=A1=C5=A1=20Virtus?= Date: Mon, 3 Feb 2020 13:31:27 +0100 Subject: [PATCH] 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 --- grml2usb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.1.4