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]

 



2018-02-06 19:29 GMT+09:00 Michael Forney <mforney@xxxxxxxxxxx>:
> On 2018-02-06, Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> wrote:
>> 2018-02-06 18:13 GMT+09:00 Michael Forney <mforney@xxxxxxxxxxx>:
>>> 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.
>>
>> I want all instances written in the same way
>> once we make a decision.
>>
>> BTW, is the output format of ls(1) standardized?
>> I am not familiar with this area.
>
> Yes, it is[0]. The -d option turns on -l, which writes lines formatted like
>
> "%s %u %s %s %u %s %s\n", <file mode>, <number of links>,
>     <owner name>, <group name>, <size>, <date and time>,
>     <pathname>

OK.  Please add this evidence with the link
into the commit log.


> but instead of writing the <owner name> and <group name>, it writes
> the numeric owner and group IDs (this avoids /etc/passwd and
> /etc/group lookups as well as potential field splitting issues).
>
> The <size> field is specified as "the value that would be returned for
> the file in the st_size field of struct stat".
>
>> Also, I am not a big fan of the mysterious two lines code.
>> (We will have some more if we fix the rest of the instances)
>>
>>
>> Perhaps, put
>> set -- $(ls -dn $1)
>> echo $5
>>
>> into "scripts/file-size.sh"  (any other suitable file name is OK)
>> then, call it like this?
>>
>>    size1=$($CONFIG_SHELL $srctree/scripts/file-size.sh .tmp_kallsyms1.o)
>>    size2=$($CONFIG_SHELL $srctree/scripts/file-size.sh .tmp_kallsyms2.o)
>>
>>
>> Is this less uglier?
>
> This sounds reasonable to me. I will make this change.
>
> [0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html#tag_20_73_10
> --
> 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



-- 
Best Regards
Masahiro Yamada
--
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