Re: [PATCH 17/19] xfsprogs: disable truncating of files

Jan Tulak
2016-04-07T09:42:08Z

[-- Attachment #1.1: Type: text/plain, Size: 1295 bytes --]

On Wed, Apr 6, 2016 at 11:42 PM, Eric Sandeen <sandeen@sandeen.net> wrote:

> On 3/24/16 6:15 AM, jtulak@redhat.com wrote:
> > From: Jan Tulak <jtulak@redhat.com>
> >
> > Unify mkfs.xfs behaviour a bit and never truncate files. If the user
> > is trying to mkfs an existing file, we don't want to destroy anything
> > he did with the file before (sparse file, allocations...)
>
> Hm, I guess so ... What motivated this change? I see that it
> changes behavior, but I'm not sure what it unifies or fixes -
> can you explain more?
>
> Both, I think. The non-truncating is a new change, a fix of undesired side
effects, where user lost his changes to the file, like sparse file... The
rest should be unifying the behavior w.r.t. mkfs arguments. Do you think
that the O_TRUNC change should be a separate patch?

> > + if (*isfile && statres != 0 && (no_size || no_name)) {
>
> statres !=0 doesn't imply ENOENT; it could be EACCES
> or several other errors. You'd need to check errno to know
> for sure.
>
> ​Well, then I need to print two errors. One if the file doesn't exists,
but additional arguments will fix it, and one for other cases, where I will
print the specific error...

​Cheers,
Jan​

--
Jan Tulak
jtulak@redhat.com / jan@tulak.me

[-- Attachment #1.2: Type: text/html, Size: 2872 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]