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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADYN=9KXUYjfKrO0u_zmFoxrLAKap8Jtc5o8CN7TL4N76YngJw@mail.gmail.com>
Date: Mon, 5 Aug 2024 11:21:00 +0200
From: Anders Roxell <anders.roxell@...aro.org>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scripts: kconfig: merge_config: config files: add a
 trailing newline

On Sat, 3 Aug 2024 at 16:26, Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> On Fri, Aug 2, 2024 at 9:42 PM Anders Roxell <anders.roxell@...aro.org> wrote:
> >
> > When merging files without trailing newlines a the end of the file, two
> > config fragments end up at the same row if file1.config doens't have a
> > trailing newline at the end of the file.
> >
> > file1.config "CONFIG_1=y"
> > file2.config "CONFIG_2=y"
> > ./scripts/kconfig/merge_config.sh -m .config file1.config file2.config
> >
> > this will generate a .config lookingn like this.
> > cat .config
> > ...
> > CONFIG_1=yCONFIG_2=y"
> >
> > Making sure so we add a newline at the end of every config file that is
> > passed into the script.
> >
> > Signed-off-by: Anders Roxell <anders.roxell@...aro.org>
> > ---
> >  scripts/kconfig/merge_config.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
> > index 902eb429b9db..ce1b77ee043b 100755
> > --- a/scripts/kconfig/merge_config.sh
> > +++ b/scripts/kconfig/merge_config.sh
> > @@ -136,7 +136,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
> >                 echo "The merge file '$ORIG_MERGE_FILE' does not exist.  Exit." >&2
> >                 exit 1
> >         fi
> > -       cat $ORIG_MERGE_FILE > $MERGE_FILE
> > +       cat $ORIG_MERGE_FILE | sed -e '$a\' > $MERGE_FILE
>
>
> Is the pipe necessary? This seems to be equivalent to:
>
>   sed -e '$a\' $ORIG_MERGE_FILE > $MERGE_FILE
>
>
>
>
>
>
> This issue also happens if $INITFILE lacks a newline at the end.
>
>
> I think the right place to insert a line is there:
>
>
>         # In case the previous file lacks a new line at the end
>         echo >> $TMP_FILE
>         cat $MERGE_FILE >> $TMP_FILE
>
>
> I am fine with always inserting a line between files.

Thank you Masahiro for your review.
Sending a v2 shortly.

Cheers,
Anders

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ