Bug 203098

Summary: [PATCH] misc/lifelines: improve wide character (UTF-8) support
Product: Ports & Packages Reporter: david
Component: Individual Port(s)Assignee: Alexey Dokuchaev <danfe>
Status: Closed FIXED    
Severity: Affects Some People CC: danfe, dhw, matt
Priority: --- Keywords: patch
Version: LatestFlags: matt: maintainer-feedback+
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch to misc/lifelines src/stdlib/icvt.c to improve wide character support none

Description david 2015-09-14 13:11:40 UTC
Created attachment 161039 [details]
patch to misc/lifelines src/stdlib/icvt.c to improve wide character support

I had been using misc/lifelines for years; up until a few weeks ago, I had no perceived need for wide character support, so I had LANG set to en_US.ISO8859-1 and LC_ALL set to C -- and things were generally working.  In particular, I had no issues with misc/lifelines.

A few weeks ago, I became convinced that certain aspects of my life (unrelated to misc/lifelines) would become significantly easier if I were to switch to UTF-8, which I did.  And once I got through the initial "turbulence," things seemed OK.

About a week later, I had occasion to use misc/lifelines for the first time since switching to UTF-8... and I found that every surname was now rendered as "?" -- which is a bit worse than merely annoying.

I whined about this on the lifelines list (LINES-L@LISTSERV.NODAK.EDU), received a couple  of suggestions (essentially, switch the environment back to non-UTF-8) which did not work for me (quite possibly because I also now have the xterm*utf8 resource set to 1), so I spent a bit of quality time with gdb (the results of which I posted to the above-cited list).

In that post, I cited some things that looked a bit odd in the code; a couple of the responses zeroed in on a section of src/stdlib/icvt.c.

Accordingly, I hacked at the code a bit, fired up gmake, and ... the resulting executable actually seems to work properly now.

It's a one-line patch that essentially makes the one line more in keeping with the pattern of others in that context, rather than looking like a copy/paste error (as one of my correspondents put it); I've attached it.

For reference, I am using lifelines-3.0.62, running:
FreeBSD g1-252.catwhisker.org 10.2-STABLE FreeBSD 10.2-STABLE #146  r287776M/287779:1002500: Mon Sep 14 04:17:32 PDT 2015     root@g1-252.catwhisker.org:/common/S1/obj/usr/src/sys/CANARY  amd64
(today).
Comment 1 david 2015-09-14 13:19:21 UTC
Ugh; silly me: I just noted that the paths on the patch aren't ideal -- should show "src/stdlib/icvt.c", rather than just "icvt.c".  Sorry about that. :-(
Comment 2 matt 2015-09-17 02:01:29 UTC
The same patch was suggested on the LINES-L mailing list by Andy Feldt (for Mac OS X) in 2012 and the correctness was confirmed by a few people at that time.

I will try to get this fixed upstream, but need to sift through 10 years of non-maintainership at sourceforge first.
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-10-23 13:09:48 UTC
A commit references this bug:

Author: danfe
Date: Fri Oct 23 13:09:11 UTC 2015
New revision: 400022
URL: https://svnweb.freebsd.org/changeset/ports/400022

Log:
  - Improve wide character (UTF-8) support, define LICENSE (MIT)
  - Convert to option helpers and thus cleanup Makefile; running `make
    package OPTIONS_UNSET=DOCS -DBATCH' will produce a docless package
    without any pre-staging-era hacks in the Makefile

  PR:		203098
  Submitted by:	dhw
  Approved by:	maintainer

Changes:
  head/misc/lifelines/Makefile
  head/misc/lifelines/files/patch-src_stdlib_icvt.c
Comment 4 Alexey Dokuchaev freebsd_committer freebsd_triage 2015-10-23 13:11:43 UTC
Committed as ports r400022 along with other changes, thanks David!