2018-02-06 18:13 GMT+09:00 Michael Forney <mforney@xxxxxxxxxxx>: > 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. Ah, right. >> $ 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. 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. 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? -- 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