Re: [PATCH] kbuild: Use ls(1) instead of stat(1) to obtain file size

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

 



On 2018-02-06, Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> wrote:
> I sometimes see patches that address portability.
> But, the resulted code is generally ugly.
> (I would not say this is too ugly in this case.)
>
>
> Also, I see some more instances.
> If 'stat' is a problem,
> do you have an idea for alternative of "stat -c %Y"?

I'm not aware of a portable alternative for that. However, it is only
used in a single place for backing up uImage and System.map. If the
`stat -c %Y` command produces no stdout, it uses the .old extension
instead which seems like reasonable fallback behavior.

> $ git grep 'stat -c'
> Documentation/acpi/ssdt-overlays.txt:dd if=$tmp
> of="$EFIVARFS/$name-$guid" bs=$(stat -c %s $tmp)
> arch/arm/boot/deflate_xip_data.sh:file_end=$(stat -c "%s" "$XIPIMAGE")
> arch/blackfin/boot/install.sh:  local stamp=$(stat -c %Y ${file}
> 2>/dev/null)
> arch/powerpc/boot/wrapper:strip_size=$(stat -c %s $vmz.$$)
> tools/testing/selftests/efivarfs/efivarfs.sh:   if [ $(stat -c %s
> $file) -ne 5 ]; then

Would you like me to include those other instances of `stat -c %s` in
this patch? I left them out for now because I wasn't sure if they
needed to be sent to various other maintainers as separate patches.
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux