#1138812 With “-ow”, write through soft links or bail out on soft links or at least warn on soft links

Package:
pngcrush
Source:
pngcrush
Description:
optimizes PNG (Portable Network Graphics) files
Submitter:
Md Ayquassar
Date:
2026-06-06 06:43:02 UTC
Severity:
normal
Tags:
#1138812#5
Date:
2026-06-04 05:57:22 UTC
From:
To:
pngcrush -ow softlink_to_a_png_file

currently removes the soft link and replaces it with a regular file. No warning is issued. Changing the file type silently by an image-processing tool is substandard behavior.
This is unwanted, particularly if you run this in scripts, such as

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.

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.)

#1138812#10
Date:
2026-06-05 08:28:55 UTC
From:
To:
Hi,

在 2026/6/4 13:57, Md Ayquassar 写道:
The origins still on the disk.
The pngcrush only a simple tool.

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


Regards,

#1138812#17
Date:
2026-06-06 03:11:18 UTC
From:
To:
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.)
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.

#1138812#22
Date:
2026-06-06 06:41:03 UTC
From:
To: