Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 58745 - rawtopgm mishandles littleendian flag
rawtopgm mishandles littleendian flag
Product: Red Hat Linux
Classification: Retired
Component: netpbm (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-01-23 18:21 EST by Joe Krahn
Modified: 2015-03-04 20:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-03-04 17:48:17 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Joe Krahn 2002-01-23 18:21:53 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.78C-MyBrowser [en] (X11; U; Linux 2.4.9-13 i686)

Description of problem:
Using rawtopgm with 2-byte images gives the same result with or without the
-littleendian flag.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. rawtopgm -bpp 2 -littleendian 100 100 raw.data >little.pgm
2. rawtopgm -bpp 2 100 100 raw.data >big.pgm
3. diff little.pgm big.pgm

Additional info:

looking in the current netpbm source, rawtopgm calls read_from_file
function incorrectly, using:

but should be:

SO, littleendian  flag is actually the row number, and we
have a big-endian first row followed by all little-endian

Bad row & col values don't hurt anything because it's
only for error messages.
Comment 1 Joe Krahn 2002-01-23 21:44:01 EST
It looks like rowskip is also mangled in rawtopgm. In i386 RedHat 7.2,
rowskip values seem to have no effect. Compiling netpbm for IRIX, I
found that declaring rowskip as double doesn't work when processing
arguments as type OPT_FLOAT. Rowskip should be a float.

Also, it seems that rowskip is a flot to support non-integral skip
amounts. This must be useful sometimes, but non-integer values
won't work for 16 bit raw data. The endianness will flip because there's
no attempt to skip in integral 16 bit amounts.
Comment 2 Phil Knirsch 2002-02-27 05:50:32 EST
I'll updated the netpbm package to the latest release in the next couple of
days. If you could give that on a shot and see if that fixes your problem i'd
greately appreciate it.

Read ya, Phil
Comment 3 Joe Krahn 2002-03-04 17:48:13 EST
It looks like the littleendian flag got fixed, but now
there's another bug. It only shows up with -O3 optimization.
In this piece of code:

compute_image_size(const struct cmdline_info cmdline, const long nread,
                   int * const rows_p, int * const cols_p) {
    if (cmdline.autosize) {

cmdline.autosize is treated as always true, but only with -O3.
Strangely, if I print that value anywhere within the subroutine,
it works OK. It also works OK if I remove the const qualifier
from the cmdline argument. Dang...

Otherwise looks good.
Comment 4 Phil Knirsch 2002-03-18 10:15:17 EST
OK, i've updated the netpbm to the latest release (9.24), so i'm closing this
bug as resolved rawhide.

As we don't build our packages with -O3 but rather -O2 the second bug you
mentioned shouldn't happen, so everything should work as expected. :-)

Read ya, Phil

Note You need to log in before you can comment on or make changes to this bug.