Skip to content

[lld][test] Fix unintentional write to a non-writeable dir #150436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

rupprecht
Copy link
Collaborator

The test added in #147970 fails trying to write a.out when run in a non-writeable directory. I believe the intent was to write to /dev/null as the output, but -o was omitted, so it's actually linking in /dev/null and writing to a.out.

The test added in llvm#147970 fails trying to write `a.out` when run in a non-writeable directory. I believe the intent was to write to /dev/null as the output, but `-o` was omitted, so it's actually linking *in* /dev/null and writing to `a.out`.
@rupprecht rupprecht added the skip-precommit-approval PR for CI feedback, not intended for review label Jul 24, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 24, 2025

@llvm/pr-subscribers-lld

Author: Jordan Rupprecht (rupprecht)

Changes

The test added in #147970 fails trying to write a.out when run in a non-writeable directory. I believe the intent was to write to /dev/null as the output, but -o was omitted, so it's actually linking in /dev/null and writing to a.out.


Full diff: https://github.com/llvm/llvm-project/pull/150436.diff

1 Files Affected:

  • (modified) lld/test/ELF/aarch64-build-attributes-malformed.s (+1-1)
diff --git a/lld/test/ELF/aarch64-build-attributes-malformed.s b/lld/test/ELF/aarch64-build-attributes-malformed.s
index f40da1ab7e8a1..c8a0fd62b20aa 100644
--- a/lld/test/ELF/aarch64-build-attributes-malformed.s
+++ b/lld/test/ELF/aarch64-build-attributes-malformed.s
@@ -1,7 +1,7 @@
 # REQUIRES: aarch64
 
 # RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o %t.o
-# RUN: ld.lld %t.o /dev/null 2>&1 | FileCheck %s
+# RUN: ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: (.ARM.attributes): unexpected end of data at offset 0x3f while reading [0x3d, 0x41)
 

@llvmbot
Copy link
Member

llvmbot commented Jul 24, 2025

@llvm/pr-subscribers-lld-elf

Author: Jordan Rupprecht (rupprecht)

Changes

The test added in #147970 fails trying to write a.out when run in a non-writeable directory. I believe the intent was to write to /dev/null as the output, but -o was omitted, so it's actually linking in /dev/null and writing to a.out.


Full diff: https://github.com/llvm/llvm-project/pull/150436.diff

1 Files Affected:

  • (modified) lld/test/ELF/aarch64-build-attributes-malformed.s (+1-1)
diff --git a/lld/test/ELF/aarch64-build-attributes-malformed.s b/lld/test/ELF/aarch64-build-attributes-malformed.s
index f40da1ab7e8a1..c8a0fd62b20aa 100644
--- a/lld/test/ELF/aarch64-build-attributes-malformed.s
+++ b/lld/test/ELF/aarch64-build-attributes-malformed.s
@@ -1,7 +1,7 @@
 # REQUIRES: aarch64
 
 # RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o %t.o
-# RUN: ld.lld %t.o /dev/null 2>&1 | FileCheck %s
+# RUN: ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: (.ARM.attributes): unexpected end of data at offset 0x3f while reading [0x3d, 0x41)
 

@rupprecht rupprecht merged commit f79efa9 into llvm:main Jul 24, 2025
13 checks passed
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
The test added in llvm#147970 fails trying to write `a.out` when run in a
non-writeable directory. I believe the intent was to write to /dev/null
as the output, but `-o` was omitted, so it's actually linking *in*
/dev/null and writing to `a.out`.
@rupprecht rupprecht deleted the lld-test-out branch August 14, 2025 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lld:ELF lld skip-precommit-approval PR for CI feedback, not intended for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants