Subject: bug#79267: cp --sparse=auto heuristic fails on a squashfs mounted drive.

From: Paul Eggert <[email-masked]>
Date: Sat, 23 Aug 2025 12:01:01 -0700

On 2025-08-23 11:27, Phillip Lougher wrote:

> Yeah let's take the attitude everyone writes well written programs, and if they don't it's their fault when they unexpectedly break in production.   In reality a lot of code in embedded Linux systems is dreadful, written by inexperienced programmers.

Inexperienced programmers don't use SEEK_HOLE or SEEK_DATA.

Several commonly-used programs would benefit from proper support for 
SEEK_HOLE and SEEK_DATA. What programs would be hurt? If nobody knows of 
such programs, we should be skeptical of the argument that support would 
be dangerous. To be honest I can't think of why it would hurt in 
practical programs.

> Anyway, my email was pointing out that the SEEK_HOLE behaviour being 
> complained about is the default Linux VFS behaviour.  So this isn't 
> about Squashfs.

Yes it is. The default behavior is appropriate for simple file systems 
that lack extents. However, Squashfs is not such a file system. If 
Squashfs has extents but does not expose them to user code, user code 
can be waaaaaayy less efficient.

And this isn't merely an efficiency issue. It can be a security issue, 
as sparse files can be used for denial-of-service attacks. I assume 
efficiency and security are of concern to Squashfs users, which is why I 
press this point.