From: Christian Weisgerber Subject: Re: Commit e600f1246e15 breaks test_update_conflict_wt_rm_vs_repo_rm on FreeBSD To: gameoftrees@openbsd.org Date: Mon, 22 Mar 2021 23:07:43 +0100 Christian Weisgerber: > I'm updating the FreeBSD port to got 0.50, and regress/cmdline/update.sh > throws an error: > > ./update.sh -q -r "/tmp" > got: readlink: /tmp/got-test-update_conflict_wt_rm_vs_repo_rm-jQlcrkFR/wt/beta: No such file or directory It's an uninitialized variable. In worktree.c:delete_blob() we have err = get_file_status(&status, &sb, ie, ondisk_path, -1, NULL, repo); if (err) goto done; if (S_ISLNK(sb.st_mode) && status != GOT_STATUS_NO_CHANGE) { char ondisk_target[PATH_MAX]; ssize_t ondisk_len = readlink(ondisk_path, ondisk_target, sizeof(ondisk_target)); However, if the open() in get_file_status() fails with ENOENT, then there is no *stat() call and sb is never set. On my FreeBSD machine, this leads to S_ISLNK(sb.st_mode) spuriously triggering the readlink() branch. -- Christian "naddy" Weisgerber naddy@mips.inka.de