git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: zip files created with git archive flags text files as binaries

From
René Scharfe <l.s.r@web.de>
Date
Mar 4, 2015, 21:13 UTC
Message-ID
<54F7756D.6080907@web.de>
In-Reply-To
<54EB7FE4.7070804@web.de>
Am 23.02.2015 um 20:30 schrieb René Scharfe:
Show 7 quoted lines
> Am 23.02.2015 um 14:58 schrieb Ulrike Fischer:
>> The zip contained four text files and a pdf.
>>
>> The CTAN maintainers informed me that all files in the zip are
>> flagged as binaries and this makes it difficult for them to process
>> them further (they want to correct line feeds of the text files:
>> http://mirror.ctan.org/tex-archive/help/ctan/CTAN-upload-addendum.html#crlf)

By the way, a workaround for CTAN could be to extract the files using unzip and zip them again using Info-ZIP zip (one of the "good zip programs" mentioned on that website). The result will be a ZIP file with text files flagged appropriately. Just saying.

Show 9 quoted lines
>> Would it be possible to correct the zip-backend so that it flags
>> text files correctly? Or alternativly could one configure git
>> archive to use another zip programm?
>
> We would have to detect the line ending format (DOS, Unix, Macintosh,
> etc.) of each file, then set the attribute "t" (text) and the host
> system.  The detection would slow down archive creation a bit and the
> resulting files would be different, of course, so this feature should
> only be enabled by a new command line option.  I'll take a look.

Actually its easier than that. unzip -a (with end-of-line conversion) doesn't care for the actual format, it simply converts all occurrences of CR, CRLF and LF to the appropriate newline chars for the platform it is running on if the text flag is set. Files with mixed line endings are normalized, i.e. they have a consistent end-of-line style afterward.

I'll send a first patch shortly.
René
Previous: René ScharfeNext: René Scharfe
Message 3 of 8 in “zip files created with git archive flags text files as binaries”
  1. Ulrike FischerFeb 23, 2015
  2. René ScharfeFeb 23, 2015
  3. René ScharfeMar 4, 2015
  4. archive-zip: add --text parameterRené Scharfe, Mar 4, 2015
  5. Junio C HamanoMar 5, 2015
  6. René ScharfeMar 5, 2015
  7. René ScharfeMar 5, 2015
  8. archive-zip: mark text files in archivesRené Scharfe, Mar 5, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.