On Wed, Nov 2, 2011 at 2:35 PM, Mark Janssen <[email protected]> wrote:
> 2011/11/2 Lluís Batlle i Rossell <[email protected]>:
>> On Wed, Nov 02, 2011 at 01:00:50PM +0100, Eduardo Morras wrote:
>>> Sorry to contact you directly Lluis, i can receive mail form list
>>> but can't post (my isp blacklisted this list)
>>
>> Weird. How could that happen?
>>
>>> At 12:19 02/11/2011, Lluís Batlle i Rossell wrote:
>>> >I've just tried:
>>> >
>>> >fossil artifact c06ece1cc56e4713435c0bd1f1b70627248b4b6b > file.png
>>> >
>>> >And this outputs only 8 bytes of the png file. Maybe the artifact command
>>> >assumes a text output?
>>>
>>> Do a cat file.png
>>>
>>> The filename 'file.png' has 8 bytes, perhaps you are getting only the 
>>> filename.
>>
>> No no, the file has more bytes:
>>
>> $ wc -l file.png
>> 12583 file.png
>> $ sha1sum file.png
>> 449e8639f9889bbff781ed916a49cb8394110f77  file.png
>> $ fossil artifact 449e8639f9889bbff781ed916a49cb8394110f77 | wc -l
>> 8
>>
>> What do you think?
>> _______________________________________________
>> fossil-users mailing list
>> [email protected]
>> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>>
>
> The artifact command uses fossil_puts to display the contents. Fossil
> puts uses strlen to determine the number of chars to be written. So
> for binary files with embedded nulls this will fail.
> Using fossil_puts in this case is arguably a mistake as it also does
> encoding conversion.
> You can work around it by providing a filename with the artifact command.
>
> Mark
>

Following patch fixes the issue.


Index: src/blob.c
==================================================================
--- src/blob.c
+++ src/blob.c
@@ -766,12 +766,11 @@
 int blob_write_to_file(Blob *pBlob, const char *zFilename){
   FILE *out;
   int wrote;

   if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){
-    fossil_puts(blob_str(pBlob), 0);
-    return blob_size(pBlob);
+    return write(1, blob_str(pBlob) , blob_size(pBlob));
   }else{
     int i, nName;
     char *zName, zBuf[1000];

     nName = strlen(zFilename);
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to