gpt4 book ai didi

Makefile: sha256sum hangs forever with 0% CPU usage(Makefile:Sha256sum永远挂起,CPU使用率为0%)

转载 作者:bug小助手 更新时间:2023-10-24 17:54:20 27 4
gpt4 key购买 nike



my Makefile behaves absolutely chaotically:

我的Makefile的行为非常混乱:


I have Makefile for backups. The backup directory has name format: 2023-09-11 and contains 3 disk image files, each with their sha256 checksum:

我有用于备份的Makefile。备份目录的名称格式为:2023-09-11,包含3个磁盘镜像文件,每个文件都有各自的sha256校验和:


# ls -1 2023-09-11/
home.img
home.img.sha256
root.img
root.img.sha256
var.img
var.img.sha256

So basically, I first transfer the backup directory from usb disk, and then check if the checksums are correct:

所以基本上,我首先从U盘转移备份目录,然后检查校验和是否正确:


Here is my makefile:

这是我的Makefile:


all: rsync shasum


rsync:
@rsync -rt --delete /mnt/udisk/LAPTOP/ .


shasum: home root var

home:
@cd 20??-??-??/ && sha256sum -c home.img.sha256

root:
@cd 20??-??-??/ && sha256sum -c root.img.sha256

var:
@cd 20??-??-??/ && sha256sum -c var.img.sha256

when i run it, the rsync target completes successfully and fiels are transfered. However then the shasum target hangs in most bizarre way: it checks the first checksum home and prints OK. Then it hangs forever and nothin happens. ps does show the second target sha256sum -c root.img.sha256 but with 0% CPU usage

当我运行它时,rsync目标成功完成,文件被传输。然而,然后shasum目标以最奇怪的方式挂起:它检查第一个检验和Home并打印OK。然后它永远挂着,什么也不会发生。PS确实显示了第二个目标sha256sum-c root.img.sha256,但CPU使用率为0%


0.0  0.0  /usr/bin/make
0.0 0.0 /bin/sh -c cd 20??-??-??/ && sha256sum -c root.img.sha256
0.0 0.0 sha256sum -c root.img.sha256

what is wrong with my Makefile?

我的Makefile有什么问题?


更多回答

that rsync deletes your Makefile if it is in .. How are you invoking make ?

如果Makefile在..中,该rsync将删除它。您将如何调用Make?

btw, why three commands? you could just invoke a single command directly in the shasum rule. eg: @cd 20??-??-??/ && sha256sum -c "$@".img.sha256

顺便说一句,为什么有三个命令?您只需在shasum规则中直接调用单个命令即可。例如:@cd 20??-??-??&&sha256sum-c“$@”.img.sha256

if running on linux, you could invoke make under something like strace -f -o /tmp/strace.log to try to see what the sha256sum is doing

如果在Linux上运行,可以在类似于strace-f-o/tmp/strace.log的目录下调用make,以尝试查看sha256sum正在执行的操作

Can't explain this. In general it's a good idea to remove the @ when debugging makefiles but that doesn't seem like it will help here. If you run that same command from your shell prompt, outside of make, does it work? You can also see what that command is doing by running strace -p <pid> (the <pid> of the sha256sum command)

我无法解释这一点。一般来说,在调试生成文件时删除@是个好主意,但在这里这似乎没有什么帮助。如果您从您外壳提示符运行相同的命令,而不是在make之外,它能工作吗?您还可以通过运行strace-p(sha256sum命令的)来查看该命令正在执行的操作

优秀答案推荐
更多回答

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com