Package: apex-nslu2
Version: 1.4.15
Severity: normal

Debian/etch APEX MTD partitions are padded with zeros as opposed to
0xffs which means that the configuration environment cannot be edited
with apex-env. 'apex-env eraseenv' does fill the partition with 0xffs,
but one needs to use the force command line parameter to force the
program to ignore the zero padding. However, apex-env does not work
with and also ignores the force parameter.

$ sudo apex-env eraseenv
error: use force option to erase region containing foreign data
Try `apex-env --help' or `apex-env --usage' for more information.

$ sudo apex-env eraseenv --force
Password:
apex-env: unrecognized option `--force'
Try `apex-env --help' or `apex-env --usage' for more information.

It actually looks like the force parameter is never parsed, so the
force parameter of the method eraseenv can't be changed from the
apex-env command line, and therefore is always false:

usr/link.h:

 void eraseenv (bool force = false);


usr/apex-env.cc:

void cmd_eraseenv (Link& link, int argc, const char** argv)
{
 if (argc == 1)
   link.eraseenv ();
 else
   throw "incorrect number of command arguments";
}


usr/Link.cc:

void Link::eraseenv (bool force)
{
 if (m_state == envNull)
   throw "no writable environment available";
 if (m_state == envNoWrite && !force)
   throw "use force option to erase region containing foreign data";

 char rgb[cbEnv];
 memset (rgb, 0xff, sizeof (rgb));

 if (   ::lseek (fhEnvBlock, ibEnv, SEEK_SET) != ibEnv
     || ::write (fhEnvBlock, rgb, cbEnv) != cbEnv)
     throw "failed to write environment";
}


-- System Information:
Debian Release: 4.0
 APT prefers testing
 APT policy: (500, 'testing')
Architecture: arm (armv5tel)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-ixp4xx
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

-- no debconf information


Gordon

--
Gordon Farquharson


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to