Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 141185

Summary: emerge uses incorrect regex to parse syncuri
Product: Portage Development Reporter: Thomas Cort (RETIRED) <tcort>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 136244    
Attachments: Fix for emerge to accept usernames

Description Thomas Cort (RETIRED) gentoo-dev 2006-07-20 09:02:37 UTC
On line 2627 of bin/emerge the following regular expression is used to get the hostname and port from syncuri:

     hostname, port=re.split("rsync://([^:/]*)(:[0-9]+)?", syncuri)[1:3];

If you look at `man rsync`, rsync URIs can contain a username. rsync://tcort@rsync.somehost.com/gentoo-portage is a valid URI that rsync understands. Someone might have a username in SYNC if he or she has a private password protected rsync server. The regular expression above puts both the username and hostname into the hostname variable.

The incorrect regular expression causes an exception in the block of code near line 2646 when the SYNC contains the username. The `emerge --sync` continues to work without a problem because the exception handler sets dosyncuri=syncuri.
Comment 1 David-John Miller 2006-08-05 00:35:55 UTC
Created attachment 93482 [details, diff]
Fix for emerge to accept usernames

This fixes the regular expression and puts the username back in after getting the ip of the host
Comment 2 Zac Medico gentoo-dev 2006-08-06 01:06:39 UTC
Thanks, this is in svn r4179.
Comment 3 Zac Medico gentoo-dev 2006-08-06 04:16:16 UTC
This has been released in 2.1.1_pre4-r4.