From bd7c8ee043dd02e2cfa3eba2ac5875fc34990610 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 8 May 2009 14:27:02 +0100 Subject: [PATCH] Bug: write_file doesn't work with strings containing ASCII NUL. --- BUGS | 2 ++ src/generator.ml | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/BUGS b/BUGS index 60bb52e..ba72ad2 100644 --- a/BUGS +++ b/BUGS @@ -49,3 +49,5 @@ Setting PATH to include /usr/sbin solves this temporarily. "internal error: reply callback called twice" This bug is rare but well-understood. Unfortunately it's also quite hard to fix cleanly. + +[libguestfs] write-file does not support strings containing ASCII NUL. diff --git a/src/generator.ml b/src/generator.ml index ef8b3aa..4679add 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -1053,7 +1053,12 @@ with length C. As a special case, if C is C<0> then the length is calculated using C (so in this case -the content cannot contain embedded ASCII NULs)."); +the content cannot contain embedded ASCII NULs). + +I Owing to a bug, writing content containing ASCII NUL +characters does I work, even if the length is specified. +We hope to resolve this bug in a future version. In the meantime +use C."); ("umount", (RErr, [String "pathordevice"]), 45, [FishAlias "unmount"], [InitEmpty, TestOutputList ( @@ -3815,6 +3820,7 @@ and c_quote str = let str = replace_str str "\r" "\\r" in let str = replace_str str "\n" "\\n" in let str = replace_str str "\t" "\\t" in + let str = replace_str str "\000" "\\0" in str (* Generate a lot of different functions for guestfish. *) -- 1.8.3.1