-------- Courriel initial --------
De : gfleury <gfle...@disroot.org>
Envoyé : 21 juin 2025 13:23:17 GMT+02:00
À : Samuel Thibault <samuel.thiba...@gnu.org>
Objet : Re: [PATCH 0/1] fix cp /dev/null file
Le 2025-01-18 18:35, Guy-Fleury Iteriteka a écrit :
> Le 18 janvier 2025 15:08:55 GMT+02:00, Samuel Thibault
> <samuel.thiba...@gnu.org> a écrit : Guy-Fleury Iteriteka, le sam. 18 janv.
> 2025 15:02:38 +0200, a ecrit: Le 18 janvier 2025 14:33:49 GMT+02:00,
> Guy-Fleury Iteriteka <gfle...@disroot.org> a écrit : Le 18 janvier 2025
> 13:35:31 GMT+02:00, Samuel Thibault <samuel.thiba...@gnu.org> a écrit :
> gfleury, le sam. 18 janv. 2025 13:10:20 +0200, a ecrit: This fixes a bug
> related to `cp /dev/null file`, where you would encounter an error like:
> `skipping file /dev/null as it was replaced while being copied`.
>
> I reduced the `st_blksize` to one page, as it is on GNU/Linux, and added a
> persistent inode `st->st_rdev`.
> We would first need to understand what is really happening.
>
> Having a large blksize shouldn't be a problem, and it helps some tools
> to tend to use a larger buffer. What line of code actually dislike this?
>
> The rdev is usually set by translators to just 0. For streamio,
> applications may want to expose a particular rdev, but for null, 0
> should be just fine. What line of code actually wants something
> different from 0?
0 should be fine i think.
I was trying to fix this line
https://github.com/coreutils/coreutils/blob/master/src%2Fcopy.c#L1266
I test setting st->st_rdev to 0.
It already is set to 0 by the caller.
> It doesn't work
But how does psame_inode() fail exactly?
I am going to check
> Samuel
hi,
i find the problem. DEV_FD_MIGHT_BE_CHR is being define to true while building
coreutils
this commit[1] from coreutils that introduce DEV_FD_MIGHT_BE_CHR
https://gitweb.git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=3b1046f80f3381af7f81aec7ed8041a883fb50fa