[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
system/1010: [Fwd: Perl script hangs up all terminal like interfaces (console, ssh, etc.)]
- To: gnats@openbsd.org
- Subject: system/1010: [Fwd: Perl script hangs up all terminal like interfaces (console, ssh, etc.)]
- From: Mari Donkers <m.donkers@chello.nl>
- Date: Thu, 16 Dec 1999 00:07:55 +0100
>Number: 1010
>Category: system
>Synopsis: Perl hangs up all terminal like interfaces
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bugs
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 15 17:20:02 MST 1999
>Last-Modified:
>Originator: Charlie Root
>Organization:
net
>Release: Perl 5.005_03
>Environment:
System : OpenBSD 2.6
Architecture: OpenBSD.i386
Machine : i386
>Description:
The Perl script below hangs up all terminal like interfaces
when executed on a quite huge RedHat rpm source archive
in an attempt to convert it to a cpio archive. The system
is not completely crashed because my OpenBSD laptop can
still access the internet through the (NAT) server (which
is also the machine with the hung up terminal interfaces).
-r--r--r-- 1 root wheel 43618415 May 29 1999 /user/banshee/XFree86_3DFX-3.3.3-5.src.rpm
The command executed (script also listed below):
extract-from-rpm XFree86_3DFX-3.3.3-5.src
The "extract-from-rpm" script from which the perl script "rpm2cpio"
is called is listed below (home brew script):
#!/bin/sh
for index in $*
do
fname=${index}
if echo "${fname}" | grep '.[rR][pP][mM]$' > /dev/null 2>&1
then
fname=`echo "${fname}" | sed 's/.[rR][pP][mM]$//g'`
fi
if ls ${fname}.[rR][pP][mM] > /dev/null 2>&1
then
if [ -r ${fname}.cpio ]
then
mv ${fname}.cpio ${fname}.cpio.bak
echo "Warning: moved ${fname}.cpio to ${fname}.cpio.bak"
fi
rpm2cpio ${fname}.rpm > ${fname}.cpio
cpio -i -d -m < ${fname}.cpio
rm -f ${fname}.cpio
else
echo "Warning: skipped ${fname} because could not find it"
fi
done
The "rpm2cpio" script is listed below (public domain script):
#!/usr/bin/perl
# Copyright (C) 1997,1998,1999, Roger Espel Llima
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and any associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# SOFTWARE'S COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE
# (whew, that's done!)
# why does the world need another rpm2cpio? because the existing one
# won't build unless you have half a ton of things that aren't really
# required for it, since it uses the same library used to extract RPM's.
# in particular, it won't build on the HPsUX box i'm on.
# add a path if desired
$gzip = "gzip";
sub printhelp {
print "rpm2cpio, perl version by orabidoo <odar\@pobox.com>\n";
print "use: rpm2cpio [file.rpm]\n";
print "dumps the contents to stdout as a GNU cpio archive\n";
exit 0;
}
if ($#ARGV == -1) {
printhelp if -t STDIN;
$f = "STDIN";
} elsif ($#ARGV == 0) {
open(F, "< $ARGV[0]") or die "Can't read file $ARGV[0]\n";
$f = 'F';
} else {
printhelp;
}
printhelp if -t STDOUT;
# gobble the file up
undef $/;
$|=1;
$rpm = <$f>;
close ($f);
($magic, $major, $minor, $crap) = unpack("NCC C90", $rpm);
die "Not an RPM\n" if $magic != 0xedabeedb;
die "Not a version 3 RPM\n" if $major != 3;
$rpm = substr($rpm, 96);
while ($rpm ne '') {
$rpm =~ s/^\c@*//s;
($magic, $crap, $sections, $bytes) = unpack("N4", $rpm);
$smagic = unpack("n", $rpm);
last if $smagic eq 0x1f8b;
die "Error: header not recognized\n" if $magic != 0x8eade801;
$rpm = substr($rpm, 16*(1+$sections) + $bytes);
}
die "bogus RPM\n" if $rpm eq '';
open(ZCAT, "|gzip -cd") || die "can't pipe to gzip\n";
print STDERR "CPIO archive found!\n";
print ZCAT $rpm;
close ZCAT;
>How-To-Repeat:
Simply execute the scripts above on a quite huge (40 Megs)
rpm archive and wait a while. The system will then hang up.
>Fix:
unknown...
--------------CFB46602522CFA4E7F10F316--
>Audit-Trail:
>Unformatted:
This is a multi-part message in MIME format.
--------------CFB46602522CFA4E7F10F316
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
--------------CFB46602522CFA4E7F10F316
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Return-Path: <root@Desktop-ep1.chello.nl>
Received: from Desktop-ep1.chello.nl ([212.83.79.6]) by relay02.chello.nl
(InterMail v4.01.00 201-232-112) with ESMTP
id <19991213234332.HAXZ923.relay02@Desktop-ep1.chello.nl>
for <m.donkers@chello.nl>; Tue, 14 Dec 1999 00:43:32 +0100
Received: (from root@localhost)
by Desktop-ep1.chello.nl (8.9.3/8.9.3) id AAA09957;
Tue, 14 Dec 1999 00:43:22 +0100 (CET)
Date: Tue, 14 Dec 1999 00:43:22 +0100 (CET)
From: Charlie Root <root@Desktop-ep1.chello.nl>
Message-Id: <199912132343.AAA09957@Desktop-ep1.chello.nl>
To: gnats@openbsd.org
Subject: Perl script hangs up all terminal like interfaces (console, ssh, etc.)
Cc: m.donkers@chello.nl
Reply-To: root@Desktop-ep1.chello.nl
X-sendbug-version: 3.97
X-Mozilla-Status2: 00000000