lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CALaQ_hqA_m8OQvygQ33qe18c7RHYVfzg12vxpnBS521282154A@mail.gmail.com>
Date: Fri, 9 May 2025 03:43:15 -0500
From: Nathan Royce <nroycea+kernel@...il.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: "scripts/config" - 'This file must be called with ". " or "source ",
 and not run directly.'

First, as an aside, when I ran: `scripts/get_maintainer.pl -f
scripts/config`, I got:
```
Bad divisor in main::vcs_assign: 0
linux-kernel@...r.kernel.org (open list)
```
I reported that prior to this report, so I didn't know who else I
should have addressed this too, and picked what seemed right from
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/scripts/config?h=v6.15-rc5.
Perhaps it's related to the git dir/worktree being in separate paths,
or the clone having been shallow?

Now, slightly related to https://lkml.org/lkml/2025/4/8/967, I believe
the issue stems from `bash` being used for the script, and not in
POSIX mode.

The output of `scripts/config` is:
```
This file must be called with ". " or "source ", and not run
directly.Manipulate options in a .config file from the command line.
Usage:
<...>
```

I originally had been setting the `POSIXLY_CORRECT` environment
variable, but would have to unset it during a kernel build due to the
`bc` issue linked above.
But in my script testing, I encountered an issue and had to break out
of my script before re-setting the variable.
When the "scripts/config" part of my script came up without the
variable set, I was seeing that "error"(? not really since it still
runs I guess).

I don't know if there's a reason for forcing `bash` to be used instead
of any `sh`, but I guess bash insists it be sourced or run as POSIX.

If you create a test script:
```
#! /bin/bash
# some comment that will be seen in the "sourcing" "error"
echo test
```
You'll see `This file must be called with ". " or "source ", and not
run directly.test`. Note how "test" was echoed.

If you use `#! /bin/sh` instead, it'll make use of whatever shell that
is (eg. symbolic link), and the shell that is called will ideally run
in POSIX mode because of it.
bash.1:
```
       If bash is invoked with the name sh, it tries to mimic the
startup behavior of historical versions of sh  as
       closely  as  possible, while conforming to the POSIX standard as well.
```

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ