commit:     234737cc635d22a7327fcde7f655dd9f54408aab
Author:     Zurab Kvachadze <zurabid2016 <AT> gmail <DOT> com>
AuthorDate: Sun Feb  8 19:01:53 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 20 19:09:33 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=234737cc

nginx-module.eclass: Handle config's with no terminating LF in src_prepare

Prepend the line calling `mv` with a newline to handle the scripts with
no terminating newline, e.g. this[1].

[1]: 
https://github.com/dvershinin/nginx_accept_language_module/blob/master/config

Closes: https://bugs.gentoo.org/967172
Signed-off-by: Zurab Kvachadze <zurabid2016 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/nginx-module.eclass | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/eclass/nginx-module.eclass b/eclass/nginx-module.eclass
index c28ff5e316d2..49ccf04cacc8 100644
--- a/eclass/nginx-module.eclass
+++ b/eclass/nginx-module.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: nginx-module.eclass
@@ -642,11 +642,13 @@ nginx-module_src_prepare() {
        sed -i -e '1i\' -e ': > build/ngx_auto_config.h' config ||
                { eend $? || die "sed failed"; }
 
-       echo 'mv build/ngx_auto_config.h build/__ngx_gentoo_mod_config.h' \
+       # Add one extra LF before the command in case the 'config' script does 
not
+       # have a trailing newline already.
+       printf "\n%s\n" 'mv build/ngx_auto_config.h 
build/__ngx_gentoo_mod_config.h' \
                >> config
-       # We specifically need the $? of echo.
+       # We specifically need the $? of printf.
        # shellcheck disable=SC2320
-       eend $? || die "echo failed"
+       eend $? || die "printf failed"
 
        # cd into module root and apply patches.
        pushd "${NGINX_MOD_S}" >/dev/null || die "pushd failed"

Reply via email to