[Debian-med-packaging] Bug#728822: [adconrad at debian.org: Bug#728822: FTBFS on big-endian architectures, patches attached]

Sebastien Jodogne s.jodogne at chu.ulg.ac.be
Tue Dec 3 09:26:14 UTC 2013


Hi Andreas,

Thanks for pointing this patch to me!

The support of big-endian architectures was only included in Orthanc 
0.7.1 (released on October 30th).

It was not present in Orthanc 0.6.2, which finally came out of the NEW 
queue yesterday. It took about 6 weeks for this version of the Debian 
package to come out. I assume this is because of the packaging of the 
new component "Orthanc Client".

I will check whether the patch from the Ubuntu team can still improve 
the upstream code of Orthanc 0.7.2.

I would like now to work on the Orthanc 0.7.2 package, but since it will 
embed the "liborthancclient0.7" package, I assume this will take several 
weeks before it is actually available.

Cheers,
Sébastien-


On 12/02/2013 05:47 PM, Andreas Tille wrote:
> Hi Sebastien,
>
> I'm not sure whether I just forwarded this patch to you but it seems it
> is not fixed yet (at least d/changelog is not closing it).  Could you as
> upstream please work on this issue because you are considered more
> competent than any Debian Med member?
>
> BTW, you can subscribe single packages in the "Package Tracking System"
> (PTS) to make sure you will not miss any relevant information.
>
> Kind regards
>
>         Andreas.
>
> ----- Forwarded message from Adam Conrad <adconrad at debian.org> -----
>
> Date: Tue, 05 Nov 2013 14:55:27 -0700
> From: Adam Conrad <adconrad at debian.org>
> To: Debian Bug Tracking System <submit at bugs.debian.org>
> Subject: Bug#728822: FTBFS on big-endian architectures, patches attached
> X-Debian-PR-Message: report 728822
> X-Debian-PR-Package: orthanc
> X-Debian-PR-Keywords: patch
> X-Debian-PR-Source: orthanc
>
> Package: orthanc
> Version: 0.6.1-1
> Severity: serious
> Tags: patch
> User: ubuntu-devel at lists.ubuntu.com
> Usertags: origin-ubuntu trusty ubuntu-patch
>
>
>
> In Ubuntu, the attached patch was applied to achieve the following:
>
>    * detect-endian.patch: Patch to correctly detect endianness of the
>      current host architecture, inspired by upstream's incomplete fix.
>    * fix-endian-png.patch: Patch from upstream to fix PngWriter and
>      the associated tests on above detected big-endian architectures.
>
> The second patch in the series is a straight backport from upstream
> of their PngWriter and testsuite fix, and should be self-evident as
> such.
>
> The first patch was heavily inspired by upstream's fix[1] for endian
> detection, except that it does it correctly for all arches, instead
> of bizarrely assuming that only __powerpc__ is big-endian.  Please
> forward this one to them as a more complete fix.
>
> If upstream is concerned that <endian.h> might not exist on Win32 (I
> have no way of checking this, so don't know), the extra include could
> be dropped, as <ctype.h> includes <endian.h> on Linux anyway.  I just
> prefer to be explicit in my includes when using features, as implicit
> includes tend to bite you when linux or glibc upstream decide to move
> things around. :)
>
> ... Adam Conrad
>
> -- System Information:
> Debian Release: wheezy/sid
>    APT prefers trusty-updates
>    APT policy: (500, 'trusty-updates'), (500, 'trusty-security'), (500, 'trusty')
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386
>
> Kernel: Linux 3.12.0-1-generic (SMP w/4 CPU cores)
> Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
>
> diff -Nru orthanc-0.6.1/debian/changelog orthanc-0.6.1/debian/changelog
> diff -Nru orthanc-0.6.1/debian/patches/detect-endian.patch orthanc-0.6.1/debian/patches/detect-endian.patch
> --- orthanc-0.6.1/debian/patches/detect-endian.patch	1969-12-31 17:00:00.000000000 -0700
> +++ orthanc-0.6.1/debian/patches/detect-endian.patch	2013-11-05 14:47:35.000000000 -0700
> @@ -0,0 +1,29 @@
> +Description: Detect correct endianness of the host machine
> +Author: Adam Conrad <adconrad at ubuntu.com>
> +Forwarded: no
> +
> +--- orthanc-0.6.1.orig/UnitTests/main.cpp
> ++++ orthanc-0.6.1/UnitTests/main.cpp
> +@@ -3,6 +3,7 @@
> + #include "gtest/gtest.h"
> +
> + #include <ctype.h>
> ++#include <endian.h>
> +
> + #include "../Core/Compression/ZlibCompressor.h"
> + #include "../Core/DicomFormat/DicomTag.h"
> +@@ -479,6 +480,14 @@ TEST(Toolbox, WriteFile)
> +   ASSERT_THROW(Toolbox::ReadFile(u, path.c_str()), OrthancException);
> + }
> +
> ++TEST(Toolbox, Endianness)
> ++{
> ++#if __BYTE_ORDER == __BIG_ENDIAN
> ++  ASSERT_EQ(Endianness_Big, Toolbox::DetectEndianness());
> ++#else // __LITTLE_ENDIAN
> ++  ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness());
> ++#endif
> ++}
> +
> + int main(int argc, char **argv)
> + {
> diff -Nru orthanc-0.6.1/debian/patches/fix-endian-png.patch orthanc-0.6.1/debian/patches/fix-endian-png.patch
> --- orthanc-0.6.1/debian/patches/fix-endian-png.patch	1969-12-31 17:00:00.000000000 -0700
> +++ orthanc-0.6.1/debian/patches/fix-endian-png.patch	2013-11-05 14:46:54.000000000 -0700
> @@ -0,0 +1,75 @@
> +Description: Fix PngWriter and associated test on big-endian arches
> +Author: Adam Conrad <adconrad at ubuntu.com>
> +Origin: https://code.google.com/p/orthanc/source/detail?r=51892be15618cc934f099bf90c1180215d5778eb
> +
> +--- orthanc-0.6.1.orig/UnitTests/Png.cpp
> ++++ orthanc-0.6.1/UnitTests/Png.cpp
> +@@ -3,6 +3,7 @@
> + #include <stdint.h>
> + #include "../Core/FileFormats/PngReader.h"
> + #include "../Core/FileFormats/PngWriter.h"
> ++#include "../Core/Toolbox.h"
> +
> + TEST(PngWriter, ColorPattern)
> + {
> +@@ -24,6 +25,11 @@ TEST(PngWriter, ColorPattern)
> +   }
> +
> +   w.WriteToFile("ColorPattern.png", width, height, pitch, Orthanc::PixelFormat_RGB24, &image[0]);
> ++
> ++  std::string f, md5;
> ++  Orthanc::Toolbox::ReadFile(f, "ColorPattern.png");
> ++  Orthanc::Toolbox::ComputeMD5(md5, f);
> ++  ASSERT_EQ("604e785f53c99cae6ea4584870b2c41d", md5);
> + }
> +
> + TEST(PngWriter, Gray8Pattern)
> +@@ -44,6 +50,11 @@ TEST(PngWriter, Gray8Pattern)
> +   }
> +
> +   w.WriteToFile("Gray8Pattern.png", width, height, pitch, Orthanc::PixelFormat_Grayscale8, &image[0]);
> ++
> ++  std::string f, md5;
> ++  Orthanc::Toolbox::ReadFile(f, "Gray8Pattern.png");
> ++  Orthanc::Toolbox::ComputeMD5(md5, f);
> ++  ASSERT_EQ("5a9b98bea3d0a6d983980cc38bfbcdb3", md5);
> + }
> +
> + TEST(PngWriter, Gray16Pattern)
> +@@ -66,6 +77,11 @@ TEST(PngWriter, Gray16Pattern)
> +   }
> +
> +   w.WriteToFile("Gray16Pattern.png", width, height, pitch, Orthanc::PixelFormat_Grayscale16, &image[0]);
> ++
> ++  std::string f, md5;
> ++  Orthanc::Toolbox::ReadFile(f, "Gray16Pattern.png");
> ++  Orthanc::Toolbox::ComputeMD5(md5, f);
> ++  ASSERT_EQ("0785866a08bf0a02d2eeff87f658571c", md5);
> + }
> +
> + TEST(PngWriter, EndToEnd)
> +--- orthanc-0.6.1.orig/Core/FileFormats/PngWriter.cpp
> ++++ orthanc-0.6.1/Core/FileFormats/PngWriter.cpp
> +@@ -174,15 +174,18 @@ namespace Orthanc
> +       {
> +       case PixelFormat_Grayscale16:
> +       case PixelFormat_SignedGrayscale16:
> +-        png_set_rows(pimpl_->png_, pimpl_->info_, &pimpl_->rows_[0]);
> +-
> ++      {
> ++        int transforms = 0;
> +         if (Toolbox::DetectEndianness() == Endianness_Little)
> +         {
> +-          // Must swap the endianness!!
> +-          png_write_png(pimpl_->png_, pimpl_->info_, PNG_TRANSFORM_SWAP_ENDIAN, NULL);
> ++          transforms = PNG_TRANSFORM_SWAP_ENDIAN;
> +         }
> +
> ++        png_set_rows(pimpl_->png_, pimpl_->info_, &pimpl_->rows_[0]);
> ++        png_write_png(pimpl_->png_, pimpl_->info_, transforms, NULL);
> ++
> +         break;
> ++      }
> +
> +       default:
> +         png_write_image(pimpl_->png_, &pimpl_->rows_[0]);
> diff -Nru orthanc-0.6.1/debian/patches/series orthanc-0.6.1/debian/patches/series
> --- orthanc-0.6.1/debian/patches/series	2013-09-16 07:39:57.000000000 -0600
> +++ orthanc-0.6.1/debian/patches/series	2013-11-05 14:36:43.000000000 -0700
> @@ -0,0 +1,2 @@
> +detect-endian.patch
> +fix-endian-png.patch
>
> _______________________________________________
> Debian-med-packaging mailing list
> Debian-med-packaging at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-packaging
>
>
> ----- End forwarded message -----
>



More information about the Debian-med-packaging mailing list