Problems applying patches

2008-11-18 Thread Dan
Apologies if this is all "basic" or "dumb" and I hope this is the 
correct mailing list.


Also, I tried posting this before but it doesn't appear to have worked, 
so I'm trying again. Apologies for any duplication.


I'm a bit of newbie when it comes to patching Linux software, and I have 
been having trouble applying the patches for Bash for ages.


I noticed a long time ago that the destination directory names in the 
patch files vary between the patches, so having read the help for the 
patch program, my initial thought was to use -p2 with it. However, 
recently, I found a posting by Chet mentioning that they had to be 
applied using the -p0 option to the patch program.


Finally, yesterday, I managed to get something working, which I've 
presented below, at the bottom of this posting.


However, the patched code fails to compile (details below - see my 
question 2).


Thanks in advance for any help.

Questions:
1) Does my guide (see below) for applying the patches make sense? I 
couldn't see any other way to make this work without creating the 
symbolic links and using the -p0 option as recommended by Chet. The 
steps in the guide work on both Fedora 9 and Asus Eee PC Xandros, i.e. 
patch does not give any errors or warnings on either.


2) The build error I get is below (after running "make -k"):

make

  ***
  * *
  * GNU bash, version 3.2.39(2)-release (i686-pc-linux-gnu)
  * *
  ***

rm -f y.tab.o
gcc  -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"i686"' 
-DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"i686-pc-linux-gnu"' 
-DCONF_VENDOR='"pc"' -DLOCALEDIR='"/usr/local/share/locale"' 
-DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include 
-I./lib   -g -O2 -c y.tab.c

/Users/chet/src/bash/src/parse.y: In function ‘decode_prompt_string’:
/Users/chet/src/bash/src/parse.y:4333: error: too few arguments to 
function ‘expand_prompt_string’

make: *** [y.tab.o] Error 1

So the question is has my patch "procedure" broken the source code?


My "mini-guide" to applying Bash patches:

These instructions allow all the patches to be applied with no errors or 
warnings.


0) Create a working directory to unpack the files into.
1) Download the Bash source code tar.gz from your favourite FTP site and 
unpack into your working directory. A new "bash-3.2" directory will be 
created by the tar utility.
2) Download the bash patches, and unpack them in a directory called 
"bash-patches"

3) Create the following symbolic links in your working directory

ln -s bash-3.2 bash-3.2.16
ln -s bash-3.2 bash-20070510
ln -s bash-3.2 bash-3.2.25
ln -s bash-3.2 bash-20080214
ln -s bash-3.2 bash-3.2-patched
ln -s bash-3.2 bash-3.2.9
ln -s bash-3.2 bash-3.2.11

The reason for creating these symbolic links is as follows: it looks 
like the patch developers used different destination directory names 
when they created their patch files. This means that the patch program 
may not be able to find the files to which it wants to apply a given 
patch file. Creating these symbolic links is one way to ensure the patch 
program can find the files it is trying to patch.


This list of symbolic links is exhaustive for patch files bash32-001 to 
bash32-039 inclusive.


4) cd to bash-patches and run the folllowing command

for i in `ls bash32-*`; do echo ---; 
echo Applying patch file $i; patch -p0 < $i; sleep 5; echo; done;


If you wish, you can remove the sleep command - I only added it so I 
could check that there were no errors or warnings from patch. The 
patches should be applied with no errors or warnings.


===





Re: Problems applying patches

2008-11-18 Thread Stephane Chazelas
On Tue, Nov 18, 2008 at 07:09:19PM +, Dan wrote:
[...]
> Questions:
> 1) Does my guide (see below) for applying the patches make sense? I 
> couldn't see any other way to make this work without creating the symbolic 
> links and using the -p0 option as recommended by Chet. The steps in the 
> guide work on both Fedora 9 and Asus Eee PC Xandros, i.e. patch does not 
> give any errors or warnings on either.
[...]

I'm not sure why you need to do all that. Here, I do:

~/install/BASH$ ls bash-3.2.tar.gz bash32*
bash32-001  bash32-008  bash32-015  bash32-022  bash32-029  bash32-036
bash32-002  bash32-009  bash32-016  bash32-023  bash32-030  bash32-037
bash32-003  bash32-010  bash32-017  bash32-024  bash32-031  bash32-038
bash32-004  bash32-011  bash32-018  bash32-025  bash32-032  bash32-039
bash32-005  bash32-012  bash32-019  bash32-026  bash32-033  bash-3.2.tar.gz
bash32-006  bash32-013  bash32-020  bash32-027  bash32-034
bash32-007  bash32-014  bash32-021  bash32-028  bash32-035
~/install/BASH$ tar xf bash-3.2.tar.gz
~/install/BASH$ cd bash-3.2
~/install/BASH/bash-3.2$ cat ../bash32* | patch -p0
patching file parse.y
patching file patchlevel.h
[...]

Maybe you've got too old a version of the "patch" utility.

Here, patch --version gives me:

patch 2.5.9
Copyright (C) 1988 Larry Wall
Copyright (C) 2003 Free Software Foundation, Inc.
[...]

> /Users/chet/src/bash/src/parse.y: In function ?decode_prompt_string?:
> /Users/chet/src/bash/src/parse.y:4333: error: too few arguments to function 
> ?expand_prompt_string?
> make: *** [y.tab.o] Error 1
>
> So the question is has my patch "procedure" broken the source code?
[...]

Yes, it looks like there has been a problem while applying
bash32-037

-- 
Stéphane




Re: Problems applying patches

2008-11-18 Thread Dan

Thank you very much for the fast reply.

Stephane Chazelas wrote:

I'm not sure why you need to do all that. Here, I do: 
[...]


Maybe you've got too old a version of the "patch" utility.

Here, patch --version gives me:

patch 2.5.9
[...]


Well, I have this exact same version of the patch program. I did all 
that business with the symbolic links because the patch program was 
complaining that it couldn't find the destination file to which to apply 
the patches when using -p0.



Yes, it looks like there has been a problem while applying
bash32-037



Ah, I see.

I shall give your suggested procedure a try. Many thanks.