supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* [skalibs] Why no negative numbers in the *_fmt routines?
@ 2011-06-07  9:40 Lloyd Zusman
  2011-06-07 11:55 ` Lloyd Zusman
  0 siblings, 1 reply; 7+ messages in thread
From: Lloyd Zusman @ 2011-06-07  9:40 UTC (permalink / raw)
  To: supervision

I want to use skalibs to support some software that I'm writing,
instead of the standard unix libraries. This is generally working
well and resulting in smaller, more efficient binaries, but I
have come across one issue that is giving me some difficulties:
the integer-based *_fmt routines do not format negative numbers.

It seems that this is due to the fact that this group of *_fmt
routines are all built on top of uint64_fmt_base(), which only
knows about unsigned positive values. This makes sense for
routines like uint_fmt() and ulong_fmt(), but it is causes problems
when passing perfectly valid integers and longs to int_fmt() and
long_fmt(), when these valid values happen to be less than zero.

Of course, I know how to work around this, but it seems like the
most efficient solution to this problem would be for skalibs to
handle negative values at the lowest level, perhaps through a new
int64_fmt_base() routine that would underlie int_fmt(), long_fmt(),
etc.

Is there any reason for why such a routine should not be written,
so that fmtscan.h could use it to build the macros for all the
signed-value routines such as int_fmt() and long_fmt()?

If no one has any objections, I'd be happy to write a patch to
skalibs which provides this functionality.

Thoughts?

Thanks.

-- 
 Lloyd Zusman
 ljz@asfast.com
 God bless you.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [skalibs] Why no negative numbers in the *_fmt routines?
  2011-06-07  9:40 [skalibs] Why no negative numbers in the *_fmt routines? Lloyd Zusman
@ 2011-06-07 11:55 ` Lloyd Zusman
  2011-06-07 12:08   ` [skalibs] long_fmt fails with FMT_LEN (was: Why no negative numbers in the *_fmt routines?) Lloyd Zusman
  0 siblings, 1 reply; 7+ messages in thread
From: Lloyd Zusman @ 2011-06-07 11:55 UTC (permalink / raw)
  To: supervision

Lloyd Zusman <ljz <at> asfast.com> writes:

> I want to use skalibs to support some software that I'm writing,
> instead of the standard unix libraries. This is generally working
> well and resulting in smaller, more efficient binaries, but I
> have come across one issue that is giving me some difficulties:
> the integer-based *_fmt routines do not format negative numbers.

I'm sorry. I missed long_fmt.c and I misread fmtscan.h. I was getting
errors with negative numbers, and I mistakenly thought that this was
due to int_fmt failing with values < 0.

Sorry for all these mistakes and for the bandwidth.

-- 
 Lloyd Zusman
 ljz@asfast.com
 God bless you.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [skalibs] long_fmt fails with FMT_LEN (was: Why no negative numbers in the *_fmt routines?)
  2011-06-07 11:55 ` Lloyd Zusman
@ 2011-06-07 12:08   ` Lloyd Zusman
  2011-06-07 13:52     ` Laurent Bercot
  0 siblings, 1 reply; 7+ messages in thread
From: Lloyd Zusman @ 2011-06-07 12:08 UTC (permalink / raw)
  To: supervision

Lloyd Zusman <ljz <at> asfast.com> writes:

> Lloyd Zusman <ljz <at> asfast.com> writes:
> 
> > [ ... ]
> > the integer-based *_fmt routines do not format negative numbers.
> 
> I'm sorry. I missed long_fmt.c and I misread fmtscan.h. I was getting
> errors with negative numbers, and I mistakenly thought that this was
> due to int_fmt failing with values < 0.

Actually, this problem is due to a bug in long_fmt. It doesn't properly
handle the FMT_LEN argument when the value to be formatted is negative.
This is evident in the source code:

unsigned int long_fmt (char *fmt, long n)
{
  if (n >= 0) return ulong_fmt(fmt, n) ;
  *fmt++ = '-' ;
  return 1 + ulong_fmt(fmt, -n) ;
}

This should be changed as follows:

unsigned int long_fmt (char *fmt, long n)
{
  if (n >= 0) return ulong_fmt(fmt, n) ;
  if (fmt != 0) *fmt++ = '-' ;
  return 1 + ulong_fmt(fmt, -n) ;
}

-- 
 Lloyd Zusman
 ljz@asfast.com
 God bless you.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [skalibs] long_fmt fails with FMT_LEN (was: Why no negative numbers in the *_fmt routines?)
  2011-06-07 12:08   ` [skalibs] long_fmt fails with FMT_LEN (was: Why no negative numbers in the *_fmt routines?) Lloyd Zusman
@ 2011-06-07 13:52     ` Laurent Bercot
  2011-06-08  0:13       ` Lloyd Zusman
  2011-06-11 13:31       ` [skalibs] Can't post on the skaware mailing list (was: long_fmt fails with FMT_LEN) Lloyd Zusman
  0 siblings, 2 replies; 7+ messages in thread
From: Laurent Bercot @ 2011-06-07 13:52 UTC (permalink / raw)
  To: Lloyd Zusman; +Cc: supervision

 Hi Lloyd,
 The skaware@list.skarnet.org list is the place to talk about skalibs...
it doesn't have much to do with supervision ;)
 Mail-Followup-To set.


> Actually, this problem is due to a bug in long_fmt. It doesn't properly
> handle the FMT_LEN argument when the value to be formatted is negative.

 Ah, the null buffer trick. Sorry, I hardly ever use either negative
numbers or null buffers, so I'm not surprised that case isn't handled. ^^'
 Thanks for the patch, applied.

 skalibs-1.0.0, with lot of fixes and new goodies, is going to be released
Real Soon Now (with incomplete documentation, but at this pace, completing
the doc would mean blasting the release date into the next century, so
complete doc will have to wait). RSN means in less than a month (really,
I swear, on my life, etc.), so I'd advise you to wait for it if you can.

 If you don't trust me when it comes to release dates (and I haven't exactly
been trustworthy about that), I can send you a pre tarball. It works, and
it's definitely better than the old 0.47 stuff you're stuck with for now.

-- 
 Laurent


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [skalibs] long_fmt fails with FMT_LEN (was: Why no negative numbers in the *_fmt routines?)
  2011-06-07 13:52     ` Laurent Bercot
@ 2011-06-08  0:13       ` Lloyd Zusman
  2011-06-11 13:31       ` [skalibs] Can't post on the skaware mailing list (was: long_fmt fails with FMT_LEN) Lloyd Zusman
  1 sibling, 0 replies; 7+ messages in thread
From: Lloyd Zusman @ 2011-06-08  0:13 UTC (permalink / raw)
  To: supervision

Laurent Bercot <ska-supervision <at> skarnet.org> writes:

> 
>  Hi Lloyd,
>  The skaware <at> list.skarnet.org list is the place to talk about skalibs...
> it doesn't have much to do with supervision ;)

I'll go to that mailing list. The only reason I went here is because
this newsgroup is specifically mentioned on the skarnet "Mailing-lists"
web page, and it's very easy for me to access this site ... and I'm
lazy. :)


>  Thanks for the patch, applied.

Thank you!


>  If you don't trust me when it comes to release dates (and I haven't exactly
> been trustworthy about that), I can send you a pre tarball. It works, and
> it's definitely better than the old 0.47 stuff you're stuck with for now.

No rush. I'll patiently wait for the new release, which I'm _sure_ will
arrive within the month.

I'll head over to the other mailing list from now on.


-- 
 Lloyd Zusman
 ljz@asfast.com
 God bless you.







^ permalink raw reply	[flat|nested] 7+ messages in thread

* [skalibs] Can't post on the skaware mailing list (was: long_fmt fails with FMT_LEN)
  2011-06-07 13:52     ` Laurent Bercot
  2011-06-08  0:13       ` Lloyd Zusman
@ 2011-06-11 13:31       ` Lloyd Zusman
  2011-06-11 15:37         ` Laurent Bercot
  1 sibling, 1 reply; 7+ messages in thread
From: Lloyd Zusman @ 2011-06-11 13:31 UTC (permalink / raw)
  To: supervision

Laurent Bercot <ska-supervision <at> skarnet.org> writes:

> 
>  Hi Lloyd,
>  The skaware <at> list.skarnet.org list is the place to talk about skalibs...
> it doesn't have much to do with supervision ;)
>  Mail-Followup-To set.

I'm sorry to post again to this group, but I have encountered a problem
with the skaware@list.skarnet.org mailing list.

Yesterday, I subscribed to that list, and I received a "WELCOME" message
which told me that my subscription was successfully processed.

Today, I tried to post a message to skaware@list.skarnet.org from my
subscription email address. Unfortunately, I received an auto-response
which tells me, among other things, "Your request could not be processed
because the command you sent was not understood."

One of the things this auto-response mentions is that I can send commands
such as "lists" to the listserver (requests@list.pageplanetsoftware.com).
I did just that, and I received the following response: "The list of
available lists is not available."

So is there a problem with the skaware mailing list? If so, should I just
be patient and try posting again a little later? Or could I be doing
something wrong?

Thanks.

-- 
 Lloyd Zusman
 ljz@asfast.com
 God bless you.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [skalibs] Can't post on the skaware mailing list (was: long_fmt fails with FMT_LEN)
  2011-06-11 13:31       ` [skalibs] Can't post on the skaware mailing list (was: long_fmt fails with FMT_LEN) Lloyd Zusman
@ 2011-06-11 15:37         ` Laurent Bercot
  0 siblings, 0 replies; 7+ messages in thread
From: Laurent Bercot @ 2011-06-11 15:37 UTC (permalink / raw)
  To: Lloyd Zusman; +Cc: supervision

> I'm sorry to post again to this group, but I have encountered a problem
> with the skaware@list.skarnet.org mailing list.

 You can write to me directly: ska-skaware@skarnet.org.


> One of the things this auto-response mentions is that I can send commands
> such as "lists" to the listserver (requests@list.pageplanetsoftware.com).

 pageplanetsoftware.com ? Wow. That is not at all the skaware list server.
 Either you mistook something else for the skaware welcome message, or
I've been hacked, or something weird happened. I'll investigate and keep
you informed.

-- 
 Laurent


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-06-11 15:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-07  9:40 [skalibs] Why no negative numbers in the *_fmt routines? Lloyd Zusman
2011-06-07 11:55 ` Lloyd Zusman
2011-06-07 12:08   ` [skalibs] long_fmt fails with FMT_LEN (was: Why no negative numbers in the *_fmt routines?) Lloyd Zusman
2011-06-07 13:52     ` Laurent Bercot
2011-06-08  0:13       ` Lloyd Zusman
2011-06-11 13:31       ` [skalibs] Can't post on the skaware mailing list (was: long_fmt fails with FMT_LEN) Lloyd Zusman
2011-06-11 15:37         ` Laurent Bercot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).