richhguard-monot...@yahoo.co.uk writes:
[Stephe]
The problem does seem to be cmd_files.cc dump_file. It needs
to write a
file_data object to a std::ostream. What function would you
recommend
instead of ''?
I did manage to get something compiled that passed the test on Linux
but can't find it now. It was something involving (), c_str() and
val() on the 'dat' variable (not sure about that one, might have been
dat()). I didn't commit it in case someone better at C++ had a better
way.
This compiles:
string const dat_string = dat.inner()(); // FIXME: debugging
output.write (dat_string.c_str(), dat.inner()().length());
(The dat_string temp var is not needed; it just aids debugging. It
should be deleted to avoid an extra copy)
But it still puts in the extra 0x0d:
stephe@takver$ dump numbers
numbers:
310d 0a32 0d0a 1..2..
stephe@takver$ dump stdout
stdout:
310d 0d0a 320d 0d0a 1...2...
Running in the debugger, I can see that the extra 0x0d is comming from
write (or something after it); dat_string contains:
(gdb) x /6xb 0x674555c
0x674555c: 0x310x0d0x0a0x320x0d0x0a
On the other hand, mtn automate get_file_of also uses dump_file, but it
passes (with the original dump_file):
check(mtn(automate, get_file_of, numbers), 0, true, false)
check(samefile(stdout, numbers))
So the problem is in the output stream, not in dump_file. 'mtn cat' uses
cout, 'mtn automate' uses something else (but I thought it eventually
uses cout; I didn't try to find it).
Since 'mtn automate get_file_of' is just as easy to use as 'mtn cat', I
suggest we document this, and leave it.
It's probably worth keeping the cat_does_not_alter_newlines test, with
an xfail, and the above check on get_file_of. That way, if something
changes, we'll know to update the documentation.
--
-- Stephe
___
Monotone-devel mailing list
Monotone-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/monotone-devel