Author Topic: XTide  (Read 1099 times)

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5673
  • Karma: +145/-1
    • View Profile
Re: XTide
« Reply #15 on: January 22, 2026, 04:48:42 pm »
I seems to have messed up the branch.
Code: [Select]
H:\tmp\LIB-TIME-tzdb>git branch
* main
  master

H:\tmp\LIB-TIME-tzdb>git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

H:\tmp\LIB-TIME-tzdb>git checkout main
Switched to branch 'main'
Your branch and 'origin/main' have diverged,
and have 5 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

H:\tmp\LIB-TIME-tzdb>git pull
fatal: refusing to merge unrelated histories

Have to delete the branch and start over I guess.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5673
  • Karma: +145/-1
    • View Profile
Re: XTide
« Reply #16 on: January 22, 2026, 10:01:40 pm »
I've sorta fixed the repository. History is a bit broken with 3 initial commits, one mine and 2 yours but I doubt it matters.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5673
  • Karma: +145/-1
    • View Profile
Re: XTide
« Reply #17 on: January 26, 2026, 10:41:26 pm »
Without looking at the code, I have to guess that -DHAVE_ISSETUGID=0 is part of the problem.  This is going to trigger the compatibility code to build.  However, since we have a issetugid(), this is going to cause a problem.

The actual problem call to setugid() doesn't seem to be guarded. Further down there is another call to setugid() that is guarded by HAVE_ISSETUGID. As a single user system it seems we can define it to 0.
Code: [Select]
/* Return 1 if the process is privileged, 0 otherwise.  */
/* static int */
int
issetugid(void)
{
# if HAVE_SYS_AUXV_H && defined AT_SECURE
  unsigned long val;
  errno = 0;
  val = getauxval(AT_SECURE);
  if (val || errno != ENOENT)
    return !!val;
# endif
# if HAVE_GETRESUID
  {
    uid_t ruid, euid, suid;
    gid_t rgid, egid, sgid;
    if (0 <= getresuid (&ruid, &euid, &suid)) {
      if ((ruid ^ euid) | (ruid ^ suid))
        return 1;
      if (0 <= getresgid (&rgid, &egid, &sgid))
        return !!((rgid ^ egid) | (rgid ^ sgid));
    }
  }
# endif

The problem with the duplicate symbols comes from strftime.c, in the case of 32bit time_t, including localtime.c, which has already been compiled.
Seems to me the call to issetugid() could be simply replaced with return 0. Not sure the best way to do that for a void function. Perhaps this?
Code: [Select]
#ifndef __OS2__
static int
issetugid(void)
#else
return 0;
#endif

Edit: Note I had to remove the static due to conflicts with our headers where issetugid() is not static.
Edit2: Testing,
Code: [Select]
localtime.c:391:1: error: expected identifier or '(' before 'return'
  391 | return 0;
      | ^~~~~~
localtime.c:393:1: error: expected identifier or '(' before '{' token
  393 | {
      | ^
make: *** [<builtin>: localtime.o] Error 1
« Last Edit: January 26, 2026, 11:27:55 pm by Dave Yeo »