`write_source_files` misclassifies missing or dangling inputs as directories
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bash
- Domain
- build-system
Research direction
Locate the write_source_files entry point and inspect its input-state checks. Verify behavior for a regular file, directory, missing input, and dangling symlink; done means unavailable inputs produce the specified actionable diagnostic on stderr and exit without being treated as directories.
Written by the indexing model from the issue text.
Description
write_source_files determines whether an input is a file using this binary check:
if [[ -f "$in" ]]; then
# copy file
else
# copy directory
fi
The else branch assumes that anything not recognized as a regular file must be a directory. However, [[ -f ]] also returns false when the input is missing or is a dangling symlink.
This produces a misleading failure. The updater reports that it is copying a directory and may eventually fail with an unrelated error such as:
mkdir: cannot create directory '<destination>': File exists
The actual problem is that the input is unavailable.
The script should distinguish all three states explicitly:
if [[ -f "$in" ]]; then
# copy file
elif [[ -d "$in" ]]; then
# copy directory
else
echo "Input is unavailable or is a dangling symlink: $in" >&2
exit 1
fi
This would not materialize remotely stored Bazel outputs or otherwise fix their absence. It would provide an accurate, actionable diagnostic instead of treating the missing input as a directory.
- Dominant language
- Starlark
- Stars
- 182
- Forks
- 134
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bazel-contrib/bazel-lib
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
bazel-contrib/bazel-lib#1293 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
bazel-contrib/bazel-lib#1295 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
bazel-contrib/bazel-lib#1287 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
bazel-contrib/bazel-lib#1282 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
bazel-contrib/bazel-lib#1273 ·
All issues in bazel-contrib/bazel-lib
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
package-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oSoWoSo/vOid_Community_repOsitory#147 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
agentic-workflows cascade-suspected
Difficulty 1/5 Under an hour Newbie friendliness 88/100