Git Product home page Git Product logo

Comments (7)

glaubitz avatar glaubitz commented on September 5, 2024

So, a first indicator is actually this:

Unsupported ioctl: cmd=0x40049409

This normally shows up at the exact same place where the m68k-dev branch crashes.

Could it be possible that the m68k-dev branch implements this ioctl but it's broken?

from qemu-m68k.

glaubitz avatar glaubitz commented on September 5, 2024

Alright, after digging for some time, I finally was able to track down the culprit.

So, what happens is that sbuild has its own embedded version of the apt-ftparchive command in the form of a Perl script:

use strict;
use warnings;

use IO::Compress::Gzip qw(gzip $GzipError);
use Digest::MD5;
use Digest::SHA;
use POSIX qw(strftime);
use POSIX qw(locale_h);

# Execute a command without /bin/sh but plain execvp while redirecting its
# standard output to a file given as the first argument.
# Using "print $fh `my_command`" has the disadvantage that "my_command" might
# be executed through /bin/sh (depending on the characters used) or that the
# output of "my_command" is very long.
sub system_redir_stdout
{
        my ($filename, @args) = @_;

        open(my $saved_stdout, ">&STDOUT") or die "cannot save stdout: $!";
        open(my $packages, '>', $filename) or die "cannot open Packages for writing: $!";
        open(STDOUT, '>&', $packages) or die "cannot redirect stdout: $!";

        system(@args) == 0 or die "system @args failed: $?";

        open(STDOUT, '>&', $saved_stdout) or die "cannot restore stdout: $!";
        close $saved_stdout;
        close $packages;
}

sub hash_file($$)
{
        my ($filename, $hashobj) = @_;
        open (my $handle, '<', $filename) or die "cannot open $filename for reading: $!";
        my $hash = $hashobj->addfile($handle)->hexdigest;
        close $handle;
        return $hash;
}

system_redir_stdout('Packages', 'dpkg-scanpackages', '.', '/dev/null');
system_redir_stdout('Sources', 'dpkg-scansources', '.', '/dev/null');

gzip 'Packages' => 'Packages.gz' or die "gzip failed: $GzipError\n";
gzip 'Sources' => 'Sources.gz' or die "gzip failed: $GzipError\n";

my $packages_md5 = hash_file('Packages', Digest::MD5->new);
my $sources_md5 = hash_file('Sources', Digest::MD5->new);
my $packagesgz_md5 = hash_file('Packages.gz', Digest::MD5->new);
my $sourcesgz_md5 = hash_file('Sources.gz', Digest::MD5->new);

my $packages_sha1 = hash_file('Packages', Digest::SHA->new(1));
my $sources_sha1 = hash_file('Sources', Digest::SHA->new(1));
my $packagesgz_sha1 = hash_file('Packages.gz', Digest::SHA->new(1));
my $sourcesgz_sha1 = hash_file('Sources.gz', Digest::SHA->new(1));

my $packages_sha256 = hash_file('Packages', Digest::SHA->new(256));
my $sources_sha256 = hash_file('Sources', Digest::SHA->new(256));
my $packagesgz_sha256 = hash_file('Packages.gz', Digest::SHA->new(256));
my $sourcesgz_sha256 = hash_file('Sources.gz', Digest::SHA->new(256));

my $packages_size = -s 'Packages';
my $sources_size = -s 'Sources';
my $packagesgz_size = -s 'Packages.gz';
my $sourcesgz_size = -s 'Sources.gz';

# The timestamp format of release files is documented here:
#   https://wiki.debian.org/RepositoryFormat#Date.2CValid-Until
# It is specified to be the same format as described in Debian Policy §4.4
#   https://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog
# or the same as in debian/changelog or the Date field in .changes files.
# or the same format as `date -R`
# To adhere to the specified format, the C or C.UTF-8 locale must be used.
my $old_locale = setlocale(LC_TIME);
setlocale(LC_TIME, "C.UTF-8");
my $datestring = strftime "%a, %d %b %Y %H:%M:%S +0000", gmtime();
setlocale(LC_TIME, $old_locale);

open(my $releasefh, '>', 'Release') or die "cannot open Release for writing: $!";

print $releasefh <<"END";
Codename: invalid
Date: $datestring
Description: Sbuild Build Dependency Temporary Archive
Label: sbuild-build-depends-archive
Origin: sbuild-build-depends-archive
Suite: invalid
MD5Sum:
 $packages_md5 $packages_size Packages
 $sources_md5 $sources_size Sources
 $packagesgz_md5 $packagesgz_size Packages.gz
 $sourcesgz_md5 $sourcesgz_size Sources.gz
SHA1:
 $packages_sha1 $packages_size Packages
 $sources_sha1 $sources_size Sources
 $packagesgz_sha1 $packagesgz_size Packages.gz
 $sourcesgz_sha1 $sourcesgz_size Sources.gz
SHA256:
 $packages_sha256 $packages_size Packages
 $sources_sha256 $sources_size Sources
 $packagesgz_sha256 $packagesgz_size Packages.gz
 $sourcesgz_sha256 $sourcesgz_size Sources.gz
END

close $releasefh;

Running this Perl script, causes the crash:

(sid-m68k-sbuild)root@ikarus:~# perl apt-ftp.pl
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US:en",
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US:en",
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
dpkg-scanpackages: info: Wrote 0 entries to output Packages file.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US:en",
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault
(sid-m68k-sbuild)root@ikarus:~#

from qemu-m68k.

vivier avatar vivier commented on September 5, 2024

Simplified to:

gmtime();

Execute:

# LANG=C perl apt-ftp.pl
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)

from qemu-m68k.

glaubitz avatar glaubitz commented on September 5, 2024

I just verified that this is fixed by e9f4459.

from qemu-m68k.

glaubitz avatar glaubitz commented on September 5, 2024

Shouldn't this actually be implemented for the different CAS2 instructions as well? There still seem to be some rare and random parse errors when building Haskell programs. I will open a new issue once I know more.

from qemu-m68k.

vivier avatar vivier commented on September 5, 2024

No, CAS2 doesn't manage several addressing modes.

from qemu-m68k.

vivier avatar vivier commented on September 5, 2024

To be clear:

this issue is not fixed by commit e9f4459. This is a fix I've added while I was reviewing the code trying to fix this issue.

For this issue, the problem was in the instruction "fmod":

HELPER(mod_FP0_FP1) calls make_quotient(),
and make_quotient() was calling floatx80_to_int32() with an uninitialiazed "float_status localstatus".
As local status was taken in the stack, its value can be anything, and can trigger the abort() in roundAndPackInt32().

I've merged the fix with the commit adding the fmod instruction.

from qemu-m68k.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.