[tz] defensive value for define on Solaris causes load of timerule to fail

Ian Abbott abbotti at mev.co.uk
Mon Jun 12 13:55:19 UTC 2017


On 12/06/17 14:34, Kees Dekker wrote:
> Retry, now to the mailing list as well.
>
>>> So, FILENAME_MAX is probably the better choice, but may be, a
>>>
>>> #if FILENAME_MAX < 260
>>> #undef FILENAME_MAX
>>> #define FILENAME_MAX 260
>>> #endif
>>>
>>> code part is needed? Then FILENAME_MAX is at a defined minimum value
>>> (of course, the limit of 260 is also quite an arbitrary choice).
>
>> I don't like the idea of redefining `FILENAME_MAX`.  Just use some
>> reasonably large value of our choosing for the length of `fullname`.
>> Even with a modern GNU/Linux `FILENAME_MAX` value of 4096 (on my system
>> at least), the `fullname` member of `union local_storage` is smaller
>> than the `u` member.
>
> Anything else is also ok, but the union now does not have 'take largest value of somethong' for the fullname member.
> It is also ok for me to say:
>
> #if FILENAME_MAX < 260
> #define TZ_FILENAME_MAX 260
> #else
> #define TZ_FILENAME_MAX FILENAME_MAX
> #endif
>
> And use TZ_FILENAME_MAX in the union.
>
> My message is just to say 'please take care for platforms where FILENAME_MAX is arbitrary (too) short'. And the value of 14, as used on Solaris, is too short, as some time rules already exceed this length.
> It makes no sense (i.e. it does not help for the other platforms) in this case that Linux has a much bigger value for this define.
> As I have checked now, on most platforms, except Solaris, it is 260. Linux uses (as one of the few) a larger value. I've checked HPUX, AIX, Windows, Solaris and several Linux flavors.

I mainly mentioned the 4096 value to say that even that high a value has 
no impact on the overall size of `union local_storage`, so there is 
scope for being quite generous (rather than picking a lower value such 
as 260).  If the OS can't handle opening filenames of that length, it 
doesn't really matter as it just changes whereabouts in the code the 
ENAMETOOLONG error number is produced.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the tz mailing list