EdgeRouter Lite & EdgeRouter 4: date command ignores timezone, shows UTC

Hi

I have the same problem on EdgeRouter Lite 3 with OpenWrt 19.07.7.

I used strace tool to track which system calls were made.

3 lines of output show what is wrong:

strace date

...
open("/etc/TZ", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=27, ...}) = 0
mmap(NULL, 6953200402636640000, PROT_READ, MAP_SHARED, 3, 0) = -1 ENOMEM (Out of memory)
...

Second parameter of mmap function should be 27 (st_size from fstat function)
instead of 6953200402636640000,
so date can't read content of TZ file.

Now, I have no spare time to look at source files, but maybe someone could do that.

Some tips:
fstat() vs. fstat64()?
type casting?

Regards

3 Likes