for file in *.png; do pngcrush -ow $file; done

In this situation, if the current directory contains a mixture of links with 
the extension .png and regular .png files, all the soft links will be silently 
turned into regular files, and their origins get forgotten forever.
The origins still on the disk.

Yes, and if the disk has lots of PNG images, the origins (the sources of the 
prior soft links) cannot be reconstructed in acceptable time. (For example, 
we'd have to compress or convert each PNG file into a unique form and then 
search for the duplicates.)

At the very least, pngcrush should warn the caller or simply bail out with an 
error message and a nonzero error code. In my personal use cases, I need the 
tool to write through a soft link. (An alternative solution, though an overkill 
for me, would be to have an option, say, “-dereference”, which would allow for 
writing through a soft link specified with the option “-ow” and bailing out on 
a soft link if “-dereference” is not supplied.)

The pngcrush only a simple tool.

The filesystem links is a little complex for such a simple tool.

Yes, and there is a difference between the current complexity of the tool and 
the complexity that a flawless implementation of “-ow” would involve. In my 
understanding, this implementation has to be re-written from scratch because of 
https://bugs.debian.org/913268 anyway.

Reply via email to