Re: [patch] v1.02 of /proc/.config

Adam Heath (doogie@debian.org)
Sat, 13 Mar 1999 15:11:50 -0600 (CST)


On Sat, 13 Mar 1999, Tigran Aivazian wrote:

> Sorry - works now. It did not work not "as is" but "as cut-n-pasted with
> some \"creativity\"" (i.e. reducing a few Xs) :)
>
> Attached is the updated version of the patch
>
> Thank you,
> Tigran.
>
>
> oldconfig: symlinks
> $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
> + scripts/mkdconfig.sh

+ $(CONFIG_SHELL) scripts/mkdconfig.sh

> diff -urN linux/scripts/mkdconfig.sh linux-2.2.3-dconfig/scripts/mkdconfig.sh
> --- linux/scripts/mkdconfig.sh Thu Jan 1 01:00:00 1970
> +++ linux-2.2.3-dconfig/scripts/mkdconfig.sh Sat Mar 13 16:55:35 1999
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +
> +tmp1=`mktemp -q /tmp/dconfig1_XXXXXX`
> +tmp2=`mktemp -q /tmp/dconfig2_XXXXXX`

tmp1=./scripts/dconfig1_tmp
tmp2=./scripts/dconfig2_tmp

Now, modify scripts/Makefile and add those 2 files to the clean target.

> +
> +echo "/* DO NOT EDIT: Automatically generated by scripts/mkdconfig.sh */" > $tmp1
> +echo "" >> $tmp1
> +echo "static char *dconfig_buf = " >> $tmp1
> +echo -n \" >> $tmp1
> +echo "\";" > $tmp2
> +
> +rm -f ./kernel/dconfig_buf.c 2> /dev/null

2>/dev/null is not needed, and -f will keep rm from complaining if that file
doesn't exist. And, it fact, the next line make the above completely
unnescessary.

> +cat $tmp1 .config $tmp2 > ./kernel/dconfig_buf.c
> +rm -f $tmp1 $tmp2 2> /dev/null

Infact, the whole thing is better written like this.

#!/bin/sh

set -e
cat << _EOM_ > ./kernel/dconfig_buf.c
/* DO NOT EDIT: Automatically generated by scripts/mkdconfig.sh */

static char *dconfig_buf =
_EOM_
echo -n \" >> ./kernel/dconfig_buf.c
cat .config >> ./kernel/dconfig_buf.c
echo >> ./kernel/dconfig_buf.c

Why have a possible race, when you can remove the race entirely?

Adam

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/