Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.64k stars 12.36k forks source link

Bug in util-linux 2.40.1 rename causes data loss #175757

Closed glensc closed 2 months ago

glensc commented 3 months ago

There's this bug:

Seems to be macOS specific, but it can cause data loss because multiple files are renamed to same filename.

Will homebrew-core accept patch reverting the breaking commit?

Verification

What were you trying to do (and why)?

Trying to prevent data loss for other users.

It's unclear how fast upstream will respond especially as macOS is not their intended use.

What happened (include all command output)?

I lost some files

What did you expect to happen?

NOT to lose files.

Step-by-step reproduction instructions (by running brew commands)

brew install util-linux
touch test_0{1,2,3,4,5}.htm
rename -v .htm .html *.htm
test -e test_01.html
test ! -e .html
ryandesign commented 3 months ago

Will homebrew-core accept patch reverting the breaking commit?

The breaking commit fixed a different bug; reverting it would unfix it so that's probably not ideal either.

iMichka commented 3 months ago

From my understanding the "different bug" was a rename being ignored when there is a trailing / in the path. That's far less critical than the new bug that was introduced. I think we should revert that commit. Maybe we can wait 24h more just to see if upstream gives a more straightforward solution.

ryandesign commented 2 months ago

There is now an upstream commit that purports to fix the problem; I have not tested yet.

ZhongRuoyu commented 2 months ago

I've tested https://github.com/util-linux/util-linux/commit/ff8ee29d648111eb222612ad4251e4c3b236a389 and https://github.com/util-linux/util-linux/commit/0309a6f5ca018d83420e49e0f9d046fecdb29261 locally and verified that they fixed the issue.

ryandesign commented 2 months ago

Me too and I added the fix to MacPorts in macports/macports-ports@baf43ea76b241b71522cce544a8918d89cb76c17.