[Bug 980393] New: command-not-found (cnf) doesn't find packages anymore
http://bugzilla.opensuse.org/show_bug.cgi?id=980393 Bug ID: 980393 Summary: command-not-found (cnf) doesn't find packages anymore Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Other Assignee: bnc-team-screening@forge.provo.novell.com Reporter: antoine.belvire@laposte.net QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- cnf (command-not-found) seems broken, it doesn't find the packages which provide the given command. It looks like bug #951977. I'm running openSUSE Tumbleweed (20160512) but I can't say which snapshot introduced the problem. It seems that there is something wrong when calling libsolv's Dataiterator in scout's bin.py:
def search(self, term, inversesearch = False): pkgmatch = [] if not inversesearch: pathreprg = re.compile(self.pathre + re.escape(term) + '$') # SEARCH_STRING without SEARCH_FILES matches basenames for d in self.pool.Dataiterator(solv.SOLVABLE_FILELIST, term, solv.Dataiterator.SEARCH_STRING): path = str(d) # do matching for path if not pathreprg.match(path): continue row = ( 'zypp (%s)' % d.solvable.repo.name.decode('utf-8'), d.solvable.name.decode('utf-8'), path[:-len(term)-1], term ) if not row in pkgmatch: pkgmatch.append( row ) else:
Steps to reproduce: 1. Run 'cnf bash' Expected result:
Program 'bash' is present in package 'bash', which is installed on your system.
Absolute path to 'bash' is '/bin/bash'. Please check your $PATH variable to see whether it contains the mentioned path.
Actual result:
bash: command not found.
-- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c1
Antoine Belvire
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c4
Antoine Belvire
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c5
Bernhard Wiedemann
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c6
--- Comment #6 from Michael Andres
Now I can reproduce it. There is probably something unclean assuming that repo names equal .repo file names
Yes. A .repo file may in fact contain many repo definitions, not just one. So it's name can't be related to any repo name.
[UniqueAlias] name=Some more or less beautiful name, often too long ...
A .repo file has INI-style. The repos unique-name (the alias) is the section name. The alias is used as directory name below /var/cache/zypp. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c7
--- Comment #7 from Michael Andres
zypper ar /tmp 'a[/]a' zypper ref 'a[/]a'
$ cat /etc/zypp/repos.d/a\[_\]a.repo [a[/]a] enabled=1 baseurl=dir:///tmp
$ ll /var/cache/zypp/raw/a\[_\]a/ total 4 -rw-r--r-- 1 root root 54 Jun 1 10:33 cookie
- alias is between 1st'[' and last']' - '/' in alias is replaced by '_' to form file/directory names -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c9
Mathias Homann
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c10
D S
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c11
--- Comment #11 from Antoine Belvire
A patch for this issue was submitted via a pull request on github. This is the link to the pull request: https://github.com/openSUSE/scout/pull/6
Is this the correct way to submit a patch? If not, could you please tell me how to correctly submit it?
What it does is, that it ignores the filename, and uses the section name as the name of the repo. In my testing it worked (openSUSE Leap 42.3, fully updated, upgraded from Leap 42.2).
Sorry for the very long delay… I forgot this one. I can confirm this patch fixes the case described in comment 4, thank you! However, it won't work if several repos are in the same .repo file, like suggested in comment 6. For example, if you combine repo-oss and repo-non-oss in the same .repo file like this: [repo-non-oss] name=repo-non-oss enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/tumbleweed/repo/non-oss type=yast2 keeppackages=0 [repo-oss] name=repo-oss enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/tumbleweed/repo/oss path=/ type=yast2 keeppackages=0 'cnf bash' won't find bash. I guess it's because you only read the first section of the .repo file. I guess doing something like this should work though: diff -up ./bin.py.orig ./bin.py --- ./bin.py.orig 2018-01-01 17:00:13.940115706 +0100 +++ ./bin.py 2018-01-01 17:19:21.632163286 +0100 @@ -27,12 +27,12 @@ class SolvParser(object): try: parser = SafeConfigParser() parser.read( '%s/%s' % (self.etcpath, repofile) ) - name = parser.sections()[0] - if parser.get(name, 'enabled') == '1': - if not os.path.isfile(self.solvfile % name): - os.system('zypper refresh') - repo = self.pool.add_repo(name) - repo.add_solv(self.solvfile % name) + for name in parser.sections(): + if parser.get(name, 'enabled') == '1': + if not os.path.isfile(self.solvfile % name): + os.system('zypper refresh') + repo = self.pool.add_repo(name) + repo.add_solv(self.solvfile % name) except: pass if not list(self.pool.repos_iter()): Could you update your pull request? -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c12
--- Comment #12 from D S
Could you update your pull request?
Sure, I updated the pull request on github. I tested it on my Leap 42.3 by writing all configured repos into one .repo file, and it worked. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c13
Antoine Belvire
(In reply to Antoine Belvire from comment #11)
Could you update your pull request?
Sure, I updated the pull request on github. I tested it on my Leap 42.3 by writing all configured repos into one .repo file, and it worked.
Thanks a lot. I've submitted a request for the scout package: https://build.opensuse.org/request/show/561288. This is just temporary, till your pull request is accepted. Also, @Bernhard, could you merge this pull request if it's fine for you? -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c14
Bernhard Wiedemann
http://bugzilla.opensuse.org/show_bug.cgi?id=980393
http://bugzilla.opensuse.org/show_bug.cgi?id=980393#c15
Antoine Belvire
participants (1)
-
bugzilla_noreply@novell.com