This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: -x doesn't work with more than two args (sed error)
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.1, Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: dmalcolm, r.david.murray, sandro.tosi
Priority: normal Keywords: easy, needs review, patch

Created on 2010-08-17 16:29 by dmalcolm, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit dmalcolm, 2010-08-17 16:29 Patch against py3k branch
Messages (4)
msg114134 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-08-17 16:29 -x fails to work with more than two tests; for example, running:
  $ ./ -x test_httplib test_http_cookies test_dl
erroneously runs test_dl

By default, "sed -e s" only substitutes the first match - the invocations within need to add the trailing "g" flag to  substitute all matches.

From "info sed":
   The `s' command can be followed by zero or more of the following
     Apply the replacement to _all_ matches to the REGEXP, not just the

Am attaching a patch.

(Seen with sed-4.2.1 on Fedora 13)
msg114136 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-08-17 16:31
FWIW it works with two args, but adding the third fails; echoing PAT indicates the generated regex is missing the "|" separator:
^(test_httplib|test_http_cookies test_dl)$
msg117392 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2010-09-25 21:23
the patch applies cleanly against up-to-date py3k branch: is there anything else to do before committing it?

msg117559 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-09-28 22:45
Fixed in py3k r85078, 3.1 r85079.  Note that the only fix required was to the 'PAT' line, the other sed expressions are operating only on single filenames-per-line and so don't need the 'g' added.

I don't see in 2.7 (or 2.6), yet the history goes back quite a few years...
Date User Action Args
2022-04-11 14:57:05adminsetgithub: 53837
2010-09-28 22:45:02r.david.murraysetstatus: open -> closed

type: behavior
versions: - Python 3.3
nosy: + r.david.murray

messages: + msg117559
resolution: fixed
stage: patch review -> resolved
2010-09-25 21:23:10sandro.tosisetnosy: + sandro.tosi
messages: + msg117392
2010-08-17 16:31:36dmalcolmsetkeywords: patch, patch, easy, needs review

messages: + msg114136
2010-08-17 16:29:35dmalcolmcreate