From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6879 invoked by alias); 18 Jun 2012 16:09:40 -0000 Received: (qmail 6867 invoked by uid 22791); 18 Jun 2012 16:09:39 -0000 X-SWARE-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout20.012.net.il (HELO mtaout20.012.net.il) (80.179.55.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Jun 2012 16:09:23 +0000 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0M5T00K00L8HXP00@a-mtaout20.012.net.il> for gdb-patches@sourceware.org; Mon, 18 Jun 2012 19:09:06 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M5T00LU6M741010@a-mtaout20.012.net.il>; Mon, 18 Jun 2012 19:09:05 +0300 (IDT) Date: Mon, 18 Jun 2012 16:09:00 -0000 From: Eli Zaretskii Subject: Re: [patch 1/2] auto-load safe-path: Permit shell wildcards In-reply-to: <20120617193703.GA5088@host2.jankratochvil.net> To: Jan Kratochvil Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83ehpceh5h.fsf@gnu.org> References: <20120617193703.GA5088@host2.jankratochvil.net> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00585.txt.bz2 > Date: Sun, 17 Jun 2012 21:37:03 +0200 > From: Jan Kratochvil > > BTW I have verified that MS-Windows native function GetFullPathName transforms > '/' -> '\': > auto-load: Using directory "c:/gdb". > auto-load: And canonicalized as "c:\gdb". > I tried it on Windows8-ReleasePreview-64bit-English.iso but with the > transformation by gdb_filename_fnmatch GDB does no longer need to depend on it > (I am for example not sure if older MS-Windows also behaved that way). GetFullPathName always converted the slashes to backslashes, since it returns the native OS file name. Not sure how this is related to the issue at hand, though. > +/* Return 1 if FILENAME matches PATTERN or if FILENAME belongs to > + a subdirectory permitted by PATTERN. Return 0 otherwise. ^^^^^^^^^^^^ Why "subdirectory" and not "directory"? Or did you mean "... or if FILENAME resides in a subdirectory of a directory that matches PATTERN"? > + gdb_realpath normalization is never done here. */ > > static ATTRIBUTE_PURE int > -filename_is_in_dir (const char *filename, const char *dir) > +filename_is_in_pattern (const char *filename_orig, const char *pattern_orig) The arguments are named differently from what the commentary says. (Do you really need the "_orig" suffix here?) > + /* Trim trailing slashes ("/") from PATTERN. */ > + while (pattern_len && IS_DIR_SEPARATOR (pattern[pattern_len - 1])) > + pattern_len--; > + pattern[pattern_len] = '\0'; Wouldn't this will do the wrong thing with a pattern such as "d:/"? (I'm not sure whether it will DTRT with "/" as well.) > + /* Trim trailing slashes ("/"). */ > + while (filename_len && IS_DIR_SEPARATOR (filename[filename_len - 1])) > + filename_len--; > + filename[filename_len] = '\0'; Same here, I think. > @value{GDBN} provides the @samp{set auto-load safe-path} setting to list > directories trusted for loading files not explicitly requested by user. > +Each directory can be also shell wildcard pattern. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "... can also be a shell wildcard." > +Each directory can be also shell wildcard pattern; Likewise. > + '*' matches only single > +component, it does not match across directory separator. "... @samp{*} matches a single component ..." Should we describe all of the wildcard meta-characters, not just '*'? The documentation part is OK with these changes. Thanks.