Bug 158226

Summary: "yast -i horde" doesn't show the "Following packages haven't been found on the medium" error
Product: [openSUSE] SUSE Linux 10.1 Reporter: Michal Marek <mmarek>
Component: YaST2Assignee: Jiri Srain <jsrain>
Status: RESOLVED FIXED QA Contact: Klaus Kämpf <kkaempf>
Severity: Minor    
Priority: P5 - None CC: suse-beta
Version: Beta 7   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: y2logs.tar.bz2

Description Michal Marek 2006-03-15 12:59:16 UTC
noarch/horde.rpm isn't on the beta7 CDs, so trying to install it should result
in an error. However

    yast -i horde

doesn't display an error. Instead, it shows the package selection dialog (with
no packages selected) and waits for input. It also happens in Qt gui. It
doesn't happen with other packages i tried. horde has been uninstalled during
the update from 10.0. The package has also been changed to noarch after 10.0.
Apart from that, it's a normal package. Will attach y2logs in a moment.
Comment 1 Michal Marek 2006-03-15 13:08:40 UTC
Created attachment 73008 [details]
y2logs.tar.bz2

I tried the commmand several times, so there will be multiple logs of it.
Comment 3 Lukas Ocilka 2006-03-15 14:34:21 UTC
ncurses and also Qt on my testing machine:

+------------------------- pop up ---------------------------+
| Following packages haven't been found on the medium: horde |
+------------------------------------------------------------+

The only difference is that my system is a new installation.
BTW: I've tried to run `yast -i horde` on your system and it reports the very same message? Please, recheck.
Comment 4 Michal Marek 2006-03-15 14:51:36 UTC
Now I see: I was in /srv/www/htdocs, which contains the subdirectory 'horde'
(with saved %config files), and this subdirectory somehow causes the described
behaviour. For example:

    cd /tmp
    mkdir NoSuchPackage
    yast -i NoSuchPackage

Now I don't know whether this is a bug or feature, close as invalid if it's
feature. But you can even

    mkdir man-pages-ja    # existing but not installed package
    yast -i man-pages-ja  # doesn't install the package

which looks more like a bug to me.
Comment 5 Lukas Ocilka 2006-03-16 15:55:06 UTC
`mkdir FAKE-DIRECTORY`
`yast2 -i FAKE-DIRECTORY`
(...)
`grep FAKE-DIRECTORY y2log` >>
2006-03-16 16:33:54 <1> liche(21346) [YCP] clients/sw_single.ycp:93 CheckWhichPackages (["FAKE-DIRECTORY"])
2006-03-16 16:33:54 <1> liche(21346) [YCP] clients/sw_single.ycp:146 Reading file FAKE-DIRECTORY
2006-03-16 16:33:54 <3> liche(21346) [Interpreter] clients/sw_single.ycp:147 Parsing file 'FAKE-DIRECTORY' failed

It just tries to parse the 'FAKE-DIRECTORY' file

See: /usr/share/YaST2/clients/sw_single.ycp line 146

`cat test_file` >>
apache2
apache2-worker

`yast2 -i test_file` >> packages would get installed
(no newline is allowed after the last entry in test_file)

Please, try this patch:
/usr/share/YaST2/clients/sw_single.ycp
Index: sw_single.ycp
===================================================================
--- sw_single.ycp       (revision 29055)
+++ sw_single.ycp       (working copy)
@@ -150,6 +150,8 @@
               {
                   string packagestr = (string) SCR::Read( .target.string, arg_name);   // string ascii file next
                   packagelist = splitstring (packagestr, "\n");
+                  // filter empty lines out, bug #158226
+                  packagelist = filter (string package, packagelist, { return !regexpmatch(package, "^ *$"); });
               }
           }
           y2milestone("packagelist: %1", packagelist );
Comment 6 Lukas Ocilka 2006-03-16 16:33:45 UTC
Fixed with this patch

Index: clients/sw_single.ycp
===================================================================
--- src/clients/sw_single.ycp   (revision 29057)
+++ src/clients/sw_single.ycp   (working copy)
@@ -29,6 +29,7 @@
     import "Label";
     import "PackageSystem";
     import "Report";
+    import "FileUtils";
 
     list<string> packagelist = [];             // list of packages to install
 
@@ -137,7 +138,7 @@
        {
           string arg_name = arg_list[0]:"";
 
-          if ( SCR::Read(.target.size, arg_name) <= 0 )                // a local file ?
+          if ( ! FileUtils::IsFile(arg_name) || FileUtils::GetSize(arg_name) <= 0 )            // Check: a local file ? bigger than 0?
           {
               packagelist = arg_list;                                  // No: expect package names
           }
@@ -150,6 +151,8 @@
               {
                   string packagestr = (string) SCR::Read( .target.string, arg_name);   // string ascii file next
                   packagelist = splitstring (packagestr, "\n");
+                  // filter empty lines out,  bug #158226
+                  packagelist = filter (string package, packagelist, { return !regexpmatch(package, "^ *$"); });
               }
           }
           y2milestone("packagelist: %1", packagelist );