Bug 148859 - Fix config file handling for mail/alpine
Summary: Fix config file handling for mail/alpine
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Doug Barton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-23 10:00 UTC by Ganael LAPLANCHE
Modified: 2010-12-05 08:00 UTC (History)
0 users

See Also:


Attachments
file.diff (4.59 KB, patch)
2010-07-23 10:00 UTC, Ganael LAPLANCHE
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ganael LAPLANCHE 2010-07-23 10:00:13 UTC
The Alpine port always remove its configuration file on uninstall, making port upgrades leading to unconditionnaly loosing a previously modified configuration.

This problem occurs because Alpine uses the -conf option to dump a "fresh" configuration file. Unfortunately, the configuration file generated with this option always includes variables already set in the system-wide Alpine configuration file (/usr/local/etc/alpine.conf). See pith/conf.c :

[...]
6029 /*------------------------------------------------------------
6030     Dump out a global pine.conf on the standard output with fresh
6031     comments.  Preserves variables currently set in SYSTEM_PINERC, if any.
6032   ----*/
6033 void
6034 dump_global_conf(void)
6035 {
[...]

Thus, any file generated with the -conf option is *stricly* similar to the current /usr/local/etc/alpine.conf file (except for comments), even if variables have been modified. During uninstall, as those files are similar, the /usr/local/etc/alpine.conf is removed.

The attached patches include a patch already sent upstream to the University of Washington (via http://www.washington.edu/alpine/commentform.html) to allow Alpine to use the -P option together with the -conf one. Specifying an empty file with -P makes Alpine to produce a *really* clean config file which can be used by the port as a .conf.sample file (as it is usually done in the ports tree).

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2010-07-23 10:00:28 UTC
Responsible Changed
From-To: freebsd-ports-bugs->dougb

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Ganael LAPLANCHE 2010-09-15 11:07:04 UTC
On Fri, 23 Jul 2010 09:00:13 GMT, FreeBSD-gnats-submit wrote

Hi Doug,

> The attached patches include a patch already sent upstream to the University
> of Washington (via http://www.washington.edu/alpine/commentform.html) to allow
> Alpine to use the -P option together with the -conf one. Specifying an empty
> file with -P makes Alpine to produce a *really* clean config file which can be
> used by the port as a .conf.sample file (as it is usually done in the ports
> tree).

Any news on this PR ?

Meanwhile, I got a mail from the Washington university : alpine is no more
maintained and is now renamed re-alpine and hosted at this address :

http://re-alpine.sourceforge.net

So, I have posted the patch on the re-alpine-devel@ mailing list but have
received no answer yet. The last release is dated 2009-08-28, and I am not sure
it is still actively maintained...

As a conclusion, my patch should be considered FreeBSD-only at the moment, but
may be interesting to fix configuration troubles encountered when
deinstalling/reinstalling the port.

Best regards,

Ganael LAPLANCHE
ganael.laplanche@martymac.org
http://www.martymac.org | http://contribs.martymac.org
Comment 3 Doug Barton freebsd_committer freebsd_triage 2010-09-15 18:54:06 UTC
On 9/15/2010 3:07 AM, Ganael LAPLANCHE wrote:
> On Fri, 23 Jul 2010 09:00:13 GMT, FreeBSD-gnats-submit wrote
>
> Hi Doug,
>
>> The attached patches include a patch already sent upstream to the University
>> of Washington (via http://www.washington.edu/alpine/commentform.html) to allow
>> Alpine to use the -P option together with the -conf one. Specifying an empty
>> file with -P makes Alpine to produce a *really* clean config file which can be
>> used by the port as a .conf.sample file (as it is usually done in the ports
>> tree).
>
> Any news on this PR ?

I noted that you posted the patch to the list, and was hoping that 
someone there would be able to comment on it. I haven't encountered the 
problems you're describing, and haven't had any other reports of similar 
problems, so to be honest I haven't prioritized it very highly.


Doug
Comment 4 Ganael LAPLANCHE 2010-09-16 10:44:47 UTC
On Wed, 15 Sep 2010 10:54:06 -0700, Doug Barton wrote

Hi Doug,

Thanks for your answer.

> I haven't encountered the problems you're describing, and haven't had any
> other reports of similar problems, so to be honest I haven't prioritized it
> very highly.

The problem is very easy to reproduce.

* backup and remove any /usr/local/etc/alpine.conf file
* cd /usr/ports/mail/alpine && make install clean
* vim /usr/local/etc/alpine.conf

Change a value, e.g. :

personal-name=test

* make deinstall

/usr/local/etc/alpine.conf is removed, while it shouldn't (because it has been
user-modified).

Best regards,

Ganael LAPLANCHE
ganael.laplanche@martymac.org
http://www.martymac.org | http://contribs.martymac.org
Comment 5 dfilter service freebsd_committer freebsd_triage 2010-12-05 07:51:53 UTC
dougb       2010-12-05 07:51:49 UTC

  FreeBSD ports repository

  Modified files:
    mail/alpine          Makefile pkg-plist 
  Added files:
    mail/alpine          pkg-install 
  Log:
  Remove CONFLICTS for the old pine stuff, it's been long enough
  
  Fix the problem mentioned in the PR related to a feature of the port
  that is useful, or dangerous depending on how you look at it. :)
  If you run 'alpine -conf > file' it will merge in values from your
  existing global conf file (/usr/local/etc/alpine.conf) and spit out a
  new file with any new features added. The port used this feature when
  I took it over, and I maintained that behavior because it is useful.
  However, it is different from the traditional behavior of installing
  a clean foo.conf.sample file, and maintaining foo.conf only if it
  differs from the sample.
  
  My solution to this problem is different than the PR's, but does not
  involve patching the source. Using the pkg-install file and taking
  advantage of the default behavior of the alpine -conf feature I have
  created the best of both worlds, a clean .sample, and merging in local
  changes if they exist.
  
  Since I'm changing stuff anyway, do both sides of the process in a
  more security-conscious way.
  
  Bump PORTREVISION since the package is now different
  
  PR:             ports/148859
  Submitted by:   Ganael Laplanche <ganael.laplanche@martymac.com>
  
  Revision  Changes    Path
  1.11      +2 -5      ports/mail/alpine/Makefile
  1.1       +32 -0     ports/mail/alpine/pkg-install (new)
  1.2       +2 -5      ports/mail/alpine/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 6 Doug Barton freebsd_committer freebsd_triage 2010-12-05 07:52:30 UTC
State Changed
From-To: open->closed


I fixed this using a different solution that does not involve 
patching the source. Thanks again for bringing this to my 
attention. 

Doug