bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cpio improvements and fixes


From: Sergey Poznyakoff
Subject: Re: cpio improvements and fixes
Date: Fri, 03 Sep 2021 07:27:07 +0200
User-agent: MH (GNU Mailutils 3.13.90)

Hi Shedi,

Thanks for your mail.  Below I'm addressing each patch separately:

> [PATCH 01/12] Add header guard to all header files

The header files are local to the project and there's no possibility of
any of them being included twice.  The '#ifdef' sentinels are thus
useless.

> [PATCH 02/12] Remove ^L from files & redundant empty lines

The linefeed characters are inserted on purpose and should not be
removed.

> [PATCH 04/12] Use the safer alternative snprintf instead of sprintf

Fixed in 4d169305dc.

> [PATCH 03/12] Format specifier fixes

Needs more investigation (the use of %zu is not portable)

> [PATCH 05/12] Enclose sizeof parameter in braces

Purely aesthetic change and, as such, arguable.  In my opinion, redundant
braces harm readability.

> [PATCH 06/12] Remove redundant condition check

Applied (86dacfe3e0)

> [PATCH 07/12] Optimize ds_resize logic

That's wrong.  The fact that x2nrealloc succeeded means only that
the allocated block is ~50% bigger than the previously used one,
but this does not imply its size is sufficient to accomodate len
bytes.  Hence the need for the loop.

> [PATCH 08/12] Reformat & refactor userspec.c

What's the purpose of this?

> [PATCH 10/12] Optimize cpio_realloc_c_name logic

Wrong.  See comment to 07/12.

> [PATCH 09/12] Use destination size in strncpy to avoid
> 'stringop-overflow' warning from gcc

tar_hdr->name is TARNAMESIZE bytes wide.  The copying is protected by
'if (name_len <= TARNAMESIZE)', which rules out any possibility of
overflow.

> [PATCH 11/12] Use strtol instead of atoi

The patch contains lots of whitespace changes, which makes it hard to
see the actual purpose.  Nevertheless:

> -      io_block_size = atoi (arg);
> +      io_block_size = (int) strtol (arg, NULL, 10);

This has little sense without proper error checking.

> [PATCH 12/12] Use void where functions don't take any arguments

That's reasonable.  I'll apply this.

Regards,
Sergey




reply via email to

[Prev in Thread] Current Thread [Next in Thread]