Skip to Content.
Sympa Menu

sm-sorcery-bugs - [SM-Sorcery-Bugs] [Bug 13571] New: undesired pathname expansion in $STD_DEBUG

sm-sorcery-bugs AT lists.ibiblio.org

Subject: Bugs for Sorcery are reported here

List archive

Chronological Thread  
  • From: bugzilla-daemon AT bugs.sourcemage.org
  • To: sm-sorcery-bugs AT lists.ibiblio.org
  • Subject: [SM-Sorcery-Bugs] [Bug 13571] New: undesired pathname expansion in $STD_DEBUG
  • Date: 26 Feb 2007 08:12:00 -0000

http://bugs.sourcemage.org/show_bug.cgi?id=13571

Summary: undesired pathname expansion in $STD_DEBUG
Product: Sorcery
Version: Untargetted future release
Platform: All
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: subroutines
AssignedTo: sm-sorcery-bugs AT lists.ibiblio.org
ReportedBy: jupp AT physik.uni-potsdam.de


Hi,

when turning on
shopt -s failglob
before casting, an obscure bug in the STD_DEBUG mechanism in libmisc becomes
visible:
/tmp/sorcery/cast/2765/casting.safe: line 757: no match:
_stddbg_file=${BASH_SOURCE[0]}

ie: after $STD_DEBUG is expanded, bash tries pathname expansion triggered by
metacharacters * and [ in the expansion text. (this is only a problem if you
have funny named files, or you are running with "failglob on" (like I do,
precisely to catch obscure problems like this one)).

I suggest this following patch:

--- ./var/lib/sorcery/modules/libmisc 2006-11-25 17:15:20.000000000 +0000
+++ ./var/lib/sorcery/modules/libmisc-patched 2007-02-25 12:51:54.000000000
+0000
@@ -1474,9 +1474,9 @@

# Standard debug line:
# file "function@line" "all" "args"
-STD_DEBUG='eval local _stddbg_file=${BASH_SOURCE[0]} ;
- _stddbg_file=${_stddbg_file##*/};
- debug "${_stddbg_file}" "${FUNCNAME[0]}@$LINENO" "$@"'
+STD_DEBUG='eval eval local _stddbg_file=\${BASH_SOURCE\[0]} \;
+ _stddbg_file=\${_stddbg_file\#\#\*/}\;
+ debug \"\${_stddbg_file}\" \"\${FUNCNAME\[0]}@\$LINENO\" \"\$@\"'


#---------------------------------------------------------------------

This prevents pathname expansion by \-quotes, and uses a second "eval" to
remove
the extra level of quoting (so we must \-quote all metacharacters, not just
those related to pathname expansion).
(of course "-quotes would be easier on the eyes but they don't prevent
pathname
expansion at this stage)

Regards,

Timo Felbinger

--
Configure bugmail: http://bugs.sourcemage.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



  • [SM-Sorcery-Bugs] [Bug 13571] New: undesired pathname expansion in $STD_DEBUG, bugzilla-daemon, 02/26/2007

Archive powered by MHonArc 2.6.24.

Top of Page