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 <[email protected]>
---
 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"
-- 
2.52.0


Reply via email to