[Bug 597772] New:=?UTF-8?Q?=20=E2=80=9CFind=E2=80=9D=20function=20in=20gpk=2Dapplication=20is=20limited=20to=20accurate=20match?=
http://bugzilla.novell.com/show_bug.cgi?id=597772 http://bugzilla.novell.com/show_bug.cgi?id=597772#c0 Summary: “Find” function in gpk-application is limited to accurate match Classification: openSUSE Product: openSUSE 11.3 Version: Factory Platform: x86 OS/Version: Other Status: NEW Severity: Major Priority: P5 - None Component: libzypp AssignedTo: zypp-maintainers@forge.provo.novell.com ReportedBy: peter.j.zhu@intel.com QAContact: qa@suse.de Found By: --- Blocker: --- Created an attachment (id=355284) --> (http://bugzilla.novell.com/attachment.cgi?id=355284) log info of pk zypp backend User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729) The Find” function in gpk-application is limited to accurate match, it means we need to fill the full package name for search, the behavior seems incompatible with the upstream gnome-packagekit. In upstream gnome-packagekit project using yum backend, the “find” function defined like this: “You can select to search for a string that is contained in package name, the package description, or search for the name of a file contained in the package”. Reproducible: Always Steps to Reproduce: (1)open gpk-application. (2)find one package using “find” function. Such as "vim-common" (3)it can find the package if using keyword "vim-common" (3)it cannot find the package if using keyword "vim" Expected Results: Can search one package by using a string that is contained in package name, the package description, or search for the name of a file contained in the package. I attached log info here. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c1
--- Comment #1 from Peter Zhu
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c2
--- Comment #2 from Peter Zhu
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c3
Michael Andres
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c4
--- Comment #4 from Michael Andres
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c5
--- Comment #5 from Michael Andres
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c6
--- Comment #6 from Peter Zhu
Having a glimpse at the backend code, I see some switch in pk-backend-zypp.cpp(backend_find_packages_thread) that calls zypp_get_packages_by_name, _by_details or _by_file (in zypp-utils.cpp) to perform the search.
zypp_get_packages_by_name uses exact matching, probably because it's used from other locations too.
I also see a memory leak in backend_find_packages_thread. Don't know whether it's actually necessary to use dynamically allocated 'std::vector', but the pointer should not be initialized with 'new std::vector' if later the query result is simply assigned. I don't know why this is not implemented using a plain std::vector. Other methods like zypp_get_patches also return pointer to allocated memory, but not all calling locations save the pointer and take care about calling delete. If all those really need to be created dynamically, it cries for a RAII solution.
@Scott: I attach 2 (untested) patches. One for the memory leak and my suggestion how to fix backend_find_packages using a PoolQuery. The comments suggested that you'd like to support multiple search strings (OR'ed). PoolQuery would be able to do this.
Thanks Michael. The two patches work very well and fix the find issue -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c7
Vincent Untz
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c8
Vincent Untz
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c9
Stephan Kulow
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c10
Vincent Untz
http://bugzilla.novell.com/show_bug.cgi?id=597772
http://bugzilla.novell.com/show_bug.cgi?id=597772#c11
Vincent Untz
participants (1)
-
bugzilla_noreply@novell.com