On Wed, Aug 10, 2022 at 7:53 PM lijiang <lijiang(a)redhat.com> wrote:
On Tue, Aug 9, 2022 at 8:28 AM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab(a)nec.com> wrote:
>
> "sum" command in coreutils-9.0 (e.g. Fedora 36) started to output a file
> name. As a result, "make" always detects a change of gdb-10.2.patch
> wrongly and re-applies it unnecessarily.
>
Good findings, Kazu.
>
> Use "cmp" command instead.
>
> Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
> ---
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 162c2baa5164..020fc8207277 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -272,7 +272,7 @@ rebuild:
> @if [ ! -f ${GDB}/${GDB}.patch ]; then \
> touch ${GDB}/${GDB}.patch; fi
> @if [ -f ${GDB}.patch ] && [ -s ${GDB}.patch ] && \
> - [ "`sum ${GDB}.patch`" != "`sum ${GDB}/${GDB}.patch`"
]; then \
> + ! cmp -s ${GDB}.patch ${GDB}/${GDB}.patch; then \
I checked these two commands and they are in different packages:
$ rpm -qf /usr/bin/sum
coreutils-9.0-5.fc36.x86_64
$ rpm -qf /usr/bin/cmp
diffutils-3.8-2.fc36.x86_64
Oh, thank you for pointing this out, I didn't notice it.
I'm not very sure if the diffutils package is installed by default in various
distributions. If not, it may fail. How about the following changes?
- [ "`sum ${GDB}.patch`" != "`sum ${GDB}/${GDB}.patch`" ];
then \
+ [[ "`md5sum ${GDB}.patch|head -c32`" != "`md5sum
${GDB}/${GDB}.patch|head -c32`" ]]; then \
And the md5sum command is in the same package with the sum command.
Yes, if we use md5sum (or sum), how about this? I would prefer:
[ "`md5sum < ${GDB}.patch`" != "`md5sum <
${GDB}/${GDB}.patch`" ]; then \
Anyway, I will be back on Aug 22nd.
Thanks,
Kazu
Thanks.
Lianbo
> (sh -x ${GDB}.patch ${TARGET}; patch -N -p0 -r- --fuzz=0 < ${GDB}.patch;
cp ${GDB}.patch ${GDB}; cd ${GDB}; \
> $(MAKE) CRASH_TARGET=${TARGET}) \
> else (cd ${GDB}/gdb; $(MAKE) CRASH_TARGET=${TARGET}); fi
> --
> 2.31.1
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines:
https://github.com/crash-utility/crash/wiki