http://bugzilla.opensuse.org/show_bug.cgi?id=1177219 Bug ID: 1177219 Summary: createzyppdeps fails when repo file lacks type field Classification: openSUSE Product: openSUSE Distribution Version: Leap 15.1 Hardware: x86-64 OS: openSUSE Leap 15.1 Status: NEW Severity: Normal Priority: P5 - None Component: Development Assignee: screening-team-bugs@suse.de Reporter: pafee@tycoint.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- Created attachment 842192 --> http://bugzilla.opensuse.org/attachment.cgi?id=842192&action=edit Avoid use of uninitialized $repo->{'type'} I have a mirror of Leap 15.1 maintained using rsync, e.g. rsync -vrlpt rsync://rsync.mirrorservice.org/download.opensuse.org/distribution/leap/15.1/repo/oss/ <path_to_webserver_htdocs> I add this mirror to my Leap 15.1 box. However the result .repo file lacks the "type" field. $ sudo zypper ar http://leap_mirror/openSUSE/distribution/leap/15.1/repo/oss/ leap $ cat /etc/zypp/repos.d/leap.repo [leap] enabled=1 autorefresh=0 baseurl=http://leap_mirror/userContent/openSUSE/distribution/leap/15.1/repo/oss/ Attempts to use the "build" utility to build RPMs in a chroot environment fail due to createzyppdeps failure. $ sudo build --repo zypp://leap myrpm.spec <snip> [ 2s] /usr/lib/build/createzyppdeps --cachedir=/var/cache/build zypp://leap [ 2s] Use of uninitialized value $type in string eq at /usr/lib/build/createzyppdeps line 58. [ 2s] Use of uninitialized value $type in string eq at /usr/lib/build/createzyppdeps line 60. [ 2s] Use of uninitialized value $type in concatenation (.) or string at /usr/lib/build/createzyppdeps line 63. [ 2s] unsupported repo type: Looking at /usr/lib/build/createzyppdeps, we can see how $type is used but without a "type=" line in the .repo file, its value is uninitialized. $ cat -n createzyppdeps 55 my $type = $repo->{'type'}; 56 my $zyppcachedir = "/var/cache/zypp/raw/$repo->{'name'}"; 57 58 if($type eq 'rpm-md') { 59 exec ("$INC[0]/createrepomddeps", '--cachedir', $cachedir, '--zypp', $zyppcachedir, $url); 60 } elsif ($type eq 'yast2') { 61 exec ("$INC[0]/createyastdeps", '--cachedir', $cachedir, '--zypp', $zyppcachedir, $url); 62 } else { 63 die "unsupported repo type: $type\n"; 64 } Perhaps in the case where "type=" is missing, assume that $type should be 'rpm-md'. Let's at least fail gracefully with a better error message. See attached patch. Version in use on Leap 15.1: $ rpm -qf /usr/lib/build/createzyppdeps build-20200110-lp151.2.3.1.noarch -- You are receiving this mail because: You are on the CC list for the bug.