Opened 6 years ago

Closed 4 years ago

#57272 closed defect (fixed)

ntpviz in ntpsec @1.1.2 cannot display anything because it cannot find the Liberation fonts

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: fhgwright (Fred Wright)
Priority: Normal Milestone:
Component: ports Version: 2.5.4
Keywords: highsierra Cc:
Port: ntpsec

Description

When I invoke ntpviz it complains:

ntpviz: WARNING: liberation truetype fonts not found

The path to the Liberation font files is coded here:

{{ ./ntpclients/ntpviz.py: for fontpath in ("/usr/share/fonts/liberation", ./ntpclients/ntpviz.py: "/usr/share/fonts/liberation-fonts", ./ntpclients/ntpviz.py: "/usr/share/fonts/truetype/liberation"): }}}

As you can see they are wrong for macOS. The package liberation-fonts installs in /opt/local/share/fonts/liberation-fonts

There is also missing a dependency of the Liberation fonts.

Portfile has

 28 patchfiles          patch-PreHighSierra.diff

I am on High Sierra and would not need it, right? With and without that patch I cannot compile the package

[216/223] Compiling build/main/ntpclients/ntplogtemp-man.txt.man-tmp
Undefined symbols for architecture x86_64:
  "_alarm_overflow", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_clock_jitter", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_clock_stability", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_config_remotely", referenced from:
      _configure in libntpd_lib.a(ntp_control.c.1.o)
  "_drift_comp", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
      _write_stats in libntpd_lib.a(ntp_util.c.1.o)
      _stats_config in libntpd_lib.a(ntp_util.c.1.o)
  "_ep_list", referenced from:
      _read_ordlist in libntpd_lib.a(ntp_control.c.1.o)
  "_findpeerbyassoc", referenced from:
      _control_unspec in libntpd_lib.a(ntp_control.c.1.o)
      _read_status in libntpd_lib.a(ntp_control.c.1.o)
      _read_variables in libntpd_lib.a(ntp_control.c.1.o)
  "_getinterface", referenced from:
      _read_mru_list in libntpd_lib.a(ntp_control.c.1.o)
  "_last_offset", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_loop_config", referenced from:
      _stats_config in libntpd_lib.a(ntp_util.c.1.o)
  "_ntpd_version", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_peer_list", referenced from:
      _read_status in libntpd_lib.a(ntp_control.c.1.o)
  "_pkt_count", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_proto_clr_stats", referenced from:
      _write_stats in libntpd_lib.a(ntp_util.c.1.o)
  "_remote_config", referenced from:
      _configure in libntpd_lib.a(ntp_control.c.1.o)
  "_sendpkt", referenced from:
      _ctl_error in libntpd_lib.a(ntp_control.c.1.o)
      _ctl_flushpkt in libntpd_lib.a(ntp_control.c.1.o)
  "_stat_count", referenced from:
      _configure in libntpd_lib.a(ntp_control.c.1.o)
      _read_mru_list in libntpd_lib.a(ntp_control.c.1.o)
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
      _write_stats in libntpd_lib.a(ntp_util.c.1.o)
  "_sys_authdelay", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_sys_ifnum", referenced from:
      _read_ordlist in libntpd_lib.a(ntp_control.c.1.o)
  "_sys_jitter", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_sys_poll", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_sys_tai", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_sys_vars", referenced from:
      _process_control in libntpd_lib.a(ntp_control.c.1.o)
      _report_event in libntpd_lib.a(ntp_control.c.1.o)
      _control_unspec in libntpd_lib.a(ntp_control.c.1.o)
      _read_status in libntpd_lib.a(ntp_control.c.1.o)
      _read_variables in libntpd_lib.a(ntp_control.c.1.o)
      _write_variables in libntpd_lib.a(ntp_control.c.1.o)
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
      ...
  "_timer_timereset", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
  "_timer_xmtcalls", referenced from:
      _ctl_putsys in libntpd_lib.a(ntp_control.c.1.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

to test my patch. Anyway, I am attaching it here.

Attachments (2)

main.log (79.8 KB) - added by ballapete (Peter "Pete" Dyballa) 6 years ago.
patch-Liberation-fonts.diff (556 bytes) - added by ballapete (Peter "Pete" Dyballa) 6 years ago.
Proposed patch to allow ntpclients/ntpviz.py find Liberation fonts

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Changed 6 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: patch-Liberation-fonts.diff added

Proposed patch to allow ntpclients/ntpviz.py find Liberation fonts

comment:1 Changed 6 years ago by jmroot (Joshua Root)

Cc: fw@… removed
Owner: set to fhgwright
Status: newassigned

The patch needs to use $prefix instead of hardcoding /opt/local.

comment:2 in reply to:  1 Changed 6 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jmroot:

The patch needs to use $prefix instead of hardcoding /opt/local.

Are you sure? The patched file ntpclients/ntpviz.py then contains

    for fontpath in ("${prefix}/share/fonts/liberation-fonts",
                     "/usr/share/fonts/liberation",
                     "/usr/share/fonts/liberation-fonts",
                     "/usr/share/fonts/truetype/liberation"):

How will ntpviz know at runtime what "${prefix}" might mean? And whose prefix is this?!

comment:3 Changed 6 years ago by fhgwright (Fred Wright)

Although there is, in fact, a bug, the description in the summary is incorrect. The code in question only relates to issuing a *warning* for the absence of the liberation fonts, and does not affect the actual operation of the program. If you have the fonts installed, and ntpviz isn't working for you, then you'll have to look elsewhere for the explanation. I have no problem running ntpviz on my machine, as long as I ignore the fonts warning and the two warnings related to the absence of temperature data. There are a couple of things to be aware of, however:

1) Depending on the date range specified, ntpviz may take quite some time to run. If you kill it due to inadequate patience, don't expect useful output.

2) The ntpviz program doesn't directly display anything at all. It merely writes a webpage, which you have to separately view in a browser.

When I first encountered this problem, I did a bit of investigation for a fix. I believe the correct fix would involve using one of the fontconfig utilities to check for the font, rather than building in knowledge of fontconfig's directory layout, but due to naming inconsistencies, the precise way to do this reliably isn't entirely obvious. I also haven't determined whether it's actually *using* the installed liberation fonts, or whether it's just falling back to some other similar fonts (a common behavior in font-aware programs). I also want to come up with a fix that's correct for all platforms, and acceptable upstream.

Given that there's significant work in coming up with the correct fix, and that the only effect of the bug is to print an ignorable warning, I haven't considered this to be a high-priority bug. And once the bug is fixed upstream, I don't think it's critical enough to apply the fix via a patchfile, rather than waiting for an ntpsec release with the fix.

As to the absence of the dependency on the liberation fonts, that's probably a legitimate bug in the port, but given that ntpviz is not a critical part of ntpsec, if the font dependency is at all "heavyweight", then adding that dependency would most likely need to be conditioned on an ntpviz variant, rather than inflicting a large set of possibly unnecessary dependencies on the user, just for a program that the user may never run.

As to whether the upstream version builds on High Sierra without patching, all I know is that it did at one time, but upstream has negligible interest in fixing Mac-specific problems at all, so I don't normally even try to build the upstream version on the Mac without my patches.

comment:4 in reply to:  3 Changed 6 years ago by ballapete (Peter "Pete" Dyballa)

Replying to fhgwright:

Alright! So let's close the case and hope for coming changes.

comment:5 Changed 5 years ago by fhgwright (Fred Wright)

I didn't remember this until I was already working on the 1.1.3 update, so nothing has changed here. However, I realized that, as far as the missing dependency is concerned, merely adding it unconditionally would be bad, since it recursively pulls in 18 dependencies only needed to run a program that many people may not even use. So a proper fix would need to include making a variant and build option for ntpviz.

BTW, I verified that the unpatched upstream 1.1.2 and 1.1.3 build fine on 10.13 and 10.14, so whatever you did in attempting to build without the patches wasn't done correctly.

comment:6 Changed 4 years ago by fhgwright (Fred Wright)

Resolution: fixed
Status: assignedclosed

In d6a18ccc0ce39a468d8b5a10977676f572798576/macports-ports (master):

ntpsec: update to 1.1.9

This includes the patches for compatibility with macOS<10.13,
which can also be seen (more readably) at:

https://gitlab.com/fhgwright/ntpsec/tree/macports_1_1_9

Switches from asciidoc to asciidoctor for building docs.

Fixes a couple of dependencies.

Fixes a bug in the default ntp.conf (more relevant now).

Adds a note regarding the new default restrictions.

Closes: #57272

TESTED:
Tested (including building the usual set of variant combinations)
on 10.5 PPC, 10.5 i386, and 10.6-10.15 x86_64.

Note: See TracTickets for help on using tickets.