[so] BUG in parser??

Daniel Avieritei so@cursuri.cs.pub.ro
1 Nov 2004 12:05:39 -0000


Pe bash arata cam asa:

bash-2.05b# ls g$HOME
ls: g/root: No such file or directory

bash-2.05b# ls $HOME/s
ls: /root/s: No such file or directory

bash-2.05b# ls g$HOME/s
ls: g/root/s: No such file or directory


pt comanda:  "ls g$HOME/s "

n-ar trebui sa am ceva de genul:
command (NULL,NULL, scmd1, 0)
scmd1(null, null,null, words1,0)
words1("ls", 0, null, words2);
words2("g",0,part1,null);
part1("HOME",1",part2,null);
part2("/s", 0, null,null);
?


Cu urmatorul program de test:
int main (void) {
	while(1) {
		printf("# ");
		yyparse();
		if ( command != NULL ) {
			printf("%s-s-s", command->scmd->words->next->string);
		}
	}
	return 0;
}

Obtinem:

bash-2.05b# gdb test
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db 
library "/lib/libthread_db.so.1".

(gdb) break 20
Breakpoint 1 at 0x80488b5: file test.c, line 20.
(gdb) run
Starting program: /home/hwork/so/tema1/test
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

  Electric Fence 2.2.0 Copyright (C) 1987-1999 Bruce Perens <bruce@perens.com>
# ls s$HOME/g

Breakpoint 1, main () at test.c:20
20                      if ( command != NULL ) {
(gdb) s
21                              printf("%s-s-s", 
command->scmd->words->next->string);
(gdb) s
18                      printf("# ");
(gdb) print command->scmd->words->string
$1 = 0x40196ffc "ls"
(gdb) print command->scmd->words->next->string
$2 = 0x4019cffc "s"
(gdb) print command->scmd->words->next->next_part->string
$3 = 0x401a4ffc "/g"


Aici n-ar trebui sa fie HOME???






----

Home, no matter how far...
http://www.home.ro