Skip to contentSkip to conversation

devtool: open kconfig fragment in binary mode

PATCH New Stephano Cetola 1 participant 1 message Mar 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtool: open kconfig fragment in binary mode

When devtool writes to the kconfig fragment, it writes the output of the diff command returned from pipe.communicate(). This function returns binary objects. We should open the kconfig fragment file in binary mode if we expect to write binary objects to it.

[YOCTO #11171]

---
 scripts/lib/devtool/standard.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/devtool/standard.py +1 -1
index 07c1400388..ffca2c9ec4 100644
@@ -1223,7 +1223,7 @@ def _create_kconfig_diff(srctree, rd, outfile):
         stdout, stderr = pipe.communicate()
         if pipe.returncode == 1:
             logger.info("Updating config fragment %s" % outfile)
-            with open(outfile, 'w') as fobj:
+            with open(outfile, 'wb') as fobj:
                 fobj.write(stdout)
         elif pipe.returncode == 0:
             logger.info("Would remove config fragment %s" % outfile)
Signature · 1 line
2.12.1