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

Re: Git Modifying DLL

From
Torsten Bögershausen <tboegi@web.de>
Date
Aug 20, 2021, 15:37 UTC
Message-ID
<20210820153756.c7b2d5zju7mkf4w5@tb-raspi4>
In-Reply-To
<CAG83euo2B4QFU_S6Yqd3UACWq63p=L+T30CwzT52D8H=S5pRVg@mail.gmail.com>

First of all, thanks for the report. (And please, no top-posting in this list, see my comments at the end)

On Thu, Aug 19, 2021 at 01:21:03PM -0500, Jonathon Anderson wrote:
Show 35 quoted lines
> I had not. I tested that and it worked. I assumed that git would
> automatically treat dll files as binary. Thanks for the help!
>
> On Thu, Aug 19, 2021 at 1:13 PM Randall S. Becker
> <rsbecker@nexbridge.com> wrote:
> >
> > On August 19, 2021 1:59 PM, Jonathon Anderson wrote:
> > >
> > >I'm having an issue with git modifying a DLL file and corrupting it.
> > >When I download the original working file, it has a hash starting with 8FE400... I then commit the DLL and push it to our repo. When I
> > >download the file from the repo, the DLL can't be loaded, and it has a hash starting with E004FB...
> > >
> > >Opening the DLL in a hex editor and using the compare feature, there's a single change to the file. In the original, the byte code starting
> > >at 0x0074 is 2E 0D 0D 0A 24.
> > >In the git file, the byte code starting at 0x0074 is 2E 0D 0A 24
> > >
> > >A single carriage return character (0x0D) has been removed, and the file size has changed from 260,608 bytes to 260,607 bytes.
> > >
> > >I ruled out the possibility that the repo server was doing anything to the file because I deleted the file in my local repository then ran "git
> > >reset --hard HEAD" to restore the file, and the hash had once again changed to E004FB...
> > >
> > >OS: Windows 10.0.19043 pro
> > >git: 2.32.0.windows.1
> > >
> > >I have no settings configured for git behavior handling line endings.
> > >
> > >The original DLL can be found here:
> > >https://www.powershellgallery.com/packages/PSWindowsUpdate/2.1.1.2
> > >
> > >Navigate to "Manual Download", download the nuget package and unzip it. The file is PSWindowsUpdate.dll
> >
> > Have you set up an entry for *.dll as binary in your .gitattributes file?
> >
> > -Randall
> >
I downloaded the dll.
I can not reproduce the issue here - so I wonder, what is going on.

Could you run the following experiment, please ? (in git bash or so)

mkdir dlltest cd dlltest git init cp whereveritis/PSWindowsUpdate.dll .

git ls-files -o --eol

# I get git ls-files --eol -o PSWindowsUpdate.dll i/ w/-text attr/ PSWindowsUpdate.dll

This means, that the file is "classified" as "-text" in the working tree. "-text" means the same as binary. And git should not change CRLF at all.

Do you have any more .gitattributes in you repo? Of course, you can run the command inside your repo. Omit the "-o" for other and simply run git ls-files --eol

Previous: Jonathon AndersonNext: Jeff King
Message 4 of 9 in “Git Modifying DLL”
  1. Jonathon AndersonAug 19, 2021
  2. Randall S. BeckerAug 19, 2021
  3. Jonathon AndersonAug 19, 2021
  4. Torsten BögershausenAug 20, 2021
  5. Jeff KingAug 20, 2021
  6. Jonathon AndersonAug 20, 2021
  7. brian m. carlsonAug 20, 2021
  8. Randall S. BeckerAug 20, 2021
  9. Jonathon AndersonSep 1, 2021

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.