mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	Fix side effect to exit status of DEBUG trap in comsub
This fixes the following: trap ':' DEBUG r=$(exit 123) echo $? # Expected 123, but actually 0. Thanks to Koichi Nakashima for the report and reproducer. src/cmd/ksh93/sh/fault.c: sh_trap(): - Restore the saved current exit status (exitval) for all traps. Do not except the DEBUG trap from doing that. I've no idea why this exception was made, but it's not correct. src/cmd/ksh93/tests/basic.sh: - Add tests. Makes progress on: https://github.com/ksh93/ksh/issues/155
This commit is contained in:
		
							parent
							
								
									5ee290c7a8
								
							
						
					
					
						commit
						d00b4b39f6
					
				
					 4 changed files with 19 additions and 2 deletions
				
			
		|  | @ -489,7 +489,7 @@ int sh_trap(const char *trap, int mode) | |||
| 	sh_popcontext(shp,&buff); | ||||
| 	shp->intrap--; | ||||
| 	sfsync(shp->outpool); | ||||
| 	if(!shp->indebug && jmpval!=SH_JMPEXIT && jmpval!=SH_JMPFUN) | ||||
| 	if(jmpval!=SH_JMPEXIT && jmpval!=SH_JMPFUN) | ||||
| 		shp->exitval=savxit; | ||||
| 	stakset(savptr,staktop); | ||||
| 	fcrestore(&savefc); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue