πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #85794

Re: INN2 - 32bit - Wheezy

#85794
From: Ivan Shmakov
Date: Mon, 29 Jul 2013 19:36
77 lines
3779 bytes
>>>>> Julien Γ‰LIE <iulius@nom-de-mon-site.com.invalid> writes:
>>>>> Hi Russ,

 >> 1. Write the piece of code that no one has had a chance to write yet
 >> to convert a CAF file from 32-bit to 64-bit.

 >> The problem is that INN uses binary off_t and similar data types
 >> directly in the on-disk structures without any ability to detect
 >> incorrect sizes or convert from old formats.  (This is, obviously, a
 >> bug, but it's a bug in the on-disk data format and therefore rather
 >> difficult to fix.)

	Well, my guess is that some heuristics may help.  For instance,
	checking that NumSlots, if read assuming 64-bit types, is a
	"sensible" value, like:

   if (NumSlots * sizeof (CAFTOCENT) < filesize) {
     /* assume 64-bit versions of the data structures */
   } else {
     /* assume 32-bit ones */
   }

 > I am still puzzled about what should be done.

[...]

 > My questions are related to how the CAF file is supposed to be
 > converted for LFS.

 > - should ARTNUM (unsigned long) be written on 8 bytes?

 > - should size_t be written on 8 bytes?

 > - should off_t be written on 8 bytes?

	Yes.

 > - should int and be written on 8 bytes?

	No; at least the amd64 (x86-64) systems seem to use 32-bit int.

 > - should time_t be written on 8 bytes?

	Yes.

 > - my example above is from a 32-bit system where an off_t is 4
 > byte-long; maybe it is already 8 byte-long on other systems; in that
 > case, should something be done for them with regards to LFS?

 > - should something else than a mere conversion of the CAF file be
 > done?  (change in the source code?)

	First of all, I'd replace all of the above with known-size
	types, like int64_t, int32_t, etc.

	Naturally, in order to preserve compatibility, /both/ 32-bit and
	64-bit variants of CAFHEADER and CAFTOCENT are to be provided,
	with some code mapping them to either the "wider" or the
	"native" version.  (There, we may choose to also implement the
	byte order conversion, BTW.)

	... Though, somehow, I now see at least /three/ variants of
	these structures:

	* 32-bit, /without/ LFS: 32-bit ARTNUM, etc.;

	* 32-bit, /with/ LFS: 32-bit ARTNUM, etc.; yet 64-bit off_t;

	* 64-bit: all types 64-bit, except int.

	Then, it should be made possible for the user to choose the
	particular format.  And besides of solving the compatibility
	issue at hand, this may also allow one to save a few bytes by
	using the "narrower" version of the format.

-- 
FSF associate member #7257	np. Wizball (high score) β€” Johan Andersson
Technical Details
Message-ID: <87ppu1p39m.fsf@violet.siamics.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder02.blueworldhosting.com!aioe.org!.POSTED!not-for-mail
References: <ko7pdg$ccs$1@matrix.darkstorm.co.uk> <877gig1i2k.fsf@windlord.stanford.edu> <kt0lf9$psp$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <87ppu1p39m.fsf@violet.siamics.net>
Subject: Re: INN2 - 32bit - Wheezy
Date: Mon, 29 Jul 2013 19:36:21 +0000
From: Ivan Shmakov <oneingray@gmail.com>
References: <ko7pdg$ccs$1@matrix.darkstorm.co.uk> <877gig1i2k.fsf@windlord.stanford.edu> <kt0lf9$psp$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder02.blueworldhosting.com!aioe.org!.POSTED!not-for-mail
Newsgroups: news.software.nntp
Organization: Aioe.org NNTP Server
Lines: 77
NNTP-Posting-Host: 41vvMPMLxfEjizuK6lSUHw.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
X-Notice: Filtered by postfilter v. 0.8.2
Cancel-Lock: sha1:TBLpJGxfJGhIBjOOKlE2+YOF7x8=
X-Original-Bytes: 3520