Package Details: htpdate 1.3.6-1

Git Clone URL: https://aur.archlinux.org/htpdate.git (read-only, click to copy)
Package Base: htpdate
Description: HTTP Time protocol
Upstream URL: https://github.com/twekkel/htpdate
Keywords: time
Licenses: GPL2
Submitter: jryan
Maintainer: yigits
Last Packager: yigits
Votes: 7
Popularity: 0.108054
First Submitted: 2015-08-25 16:54 (UTC)
Last Updated: 2022-08-11 12:55 (UTC)

Latest Comments

1 2 Next › Last »

yigits commented on 2022-06-06 14:26 (UTC)

Package migrated to new fork (was https://github.com/angeloc/htpdate) and updated

Thanks for letting me know about the up-to-date fork

vHPtmUPryYrps5QS commented on 2021-08-10 22:49 (UTC)

the new git repository is this

pedh commented on 2020-05-06 13:22 (UTC)

It works now, Thank you very much!

dschrempf commented on 2020-05-06 11:21 (UTC)

Thank you. I have updated the package. I had to recreate the patch myself, because yours was rejected. Did you use diff -u to create the patch? Anyways, please let me know if it works!

pedh commented on 2020-05-06 08:01 (UTC) (edited on 2020-05-06 08:14 (UTC) by pedh)

The systemd htpdate unit hangs up and reports that no process was found.

May 06 14:07:33 pedh systemd[1]: htpdate.service: New main PID 24661 does not exist or is a zombie.

The process actually exists, but the PID value is different with the value from the pid file.

➜  ~ ps auxww | grep htpdate
root      286805  0.0  0.0   2320    76 ?        S    14:07   0:00 /usr/bin/htpdate -D -a -s www.linux.org www.freebsd.org ntp.neu.edu.cn www.kernel.org

After reading the source code, I found that the PID value, which is pid_t type, should be signed integer ( glibc reference ), is truncated to unsigned short and written to the pid file, and cause the incorrectness. The systemd unit starts successfully after the error was fixed.

Here is the patch.

htpdate.c

*************** static void runasdaemon( char *pidfile )
*** 499,505 ****
            printlog( 1, "Error writing pid file" );
            exit(1);
        } else {
!           fprintf( pid_file, "%u\n", (unsigned short)pid );
            fclose( pid_file );
        }
        printlog( 0, "htpdate version "VERSION" started" );
--- 499,505 ----
            printlog( 1, "Error writing pid file" );
            exit(1);
        } else {
!           fprintf( pid_file, "%d\n", (signed int)pid );
            fclose( pid_file );
        }
        printlog( 0, "htpdate version "VERSION" started" );

dschrempf commented on 2020-01-23 14:57 (UTC)

Thank you for your comment! I have fixed the PID file bug, but still use a forking systemd file. It works on my computer. Please let me know, if you still have problems!

wongsyrone commented on 2020-01-22 02:40 (UTC)

It fails to start due to incorrect PID. The current workaround is run as oneshot and create a timer.

/etc/systemd/system/htpdate.service

[Unit]
Description=Htpdate daemon

[Service]
Type=oneshot
StandardError=journal
User=root
ExecStart=/usr/bin/htpdate -a -s -i /run/htpdate.pid -P 192.168.8.60:808 -u root:root www.linux.org www.freebsd.org ntp.neu.edu.cn www.kernel.org

[Install]
WantedBy=multi-user.target

/etc/systemd/system/htpdate.timer

[Unit]
Description=Htpdate 30sec timer

[Timer]
OnBootSec=0min
OnCalendar=*-*-* *:*:30
Unit=htpdate.service

[Install]
WantedBy=basic.target

dschrempf commented on 2019-02-06 13:37 (UTC)

Hello,

I tried to apply the patches, but the first one 100-xxx was rejected. If you want, you can investigate the issue.

patching file htpdate.c Hunk #1 succeeded at 391 (offset 32 lines). Hunk #2 FAILED at 377. 1 out of 2 hunks FAILED -- saving rejects to file htpdate.c.rej

--- htpdate.c +++ htpdate.c @@ -377,7 +377,7 @@ static int htpdate_adjtimex( double drif printlog( 1, "seteuid()" ); exit(1); } else { - return( ntp_adjtime(&tmx) ); + return( adjtimex(&tmx) ); }

}

wongsyrone commented on 2019-02-04 08:58 (UTC)

Do you mind add patches from OpenWrt?

https://github.com/openwrt/packages/tree/master/net/htpdate/patches

dschrempf commented on 2019-02-03 22:16 (UTC)

Thanks, updated.