trust_router reads editor auto-save files as config files

Bug #1199545 reported by Sam Hartman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Moonshot Trust-Router
Fix Released
Medium
Jennifer Richards

Bug Description

Emacs someties creates .#file when editing file. So trust_router finds .#portal.cfg after I edit portal.cfg sometimes. It does not parse as a config file and wouldn't be desirable to parse even if it did.

Margaret Cullen (mrw42)
Changed in moonshot-tr:
importance: Undecided → Low
status: New → Confirmed
assignee: nobody → Margaret Wasserman (mrw42)
Changed in moonshot-tr:
importance: Low → Medium
Revision history for this message
Mark Donnelly (meadmaker) wrote :

I would generalize this to say that the trust router should ignore any dot-files.

Changed in moonshot-tr:
assignee: Margaret Cullen (mrw42) → Jennifer Richards (jennifer-k)
Revision history for this message
Sam Hartman (hartmans) wrote : Re: [Bug 1199545] Re: trust_router reads editor auto-save files as config files

>>>>> "Mark" == Mark Donnelly <email address hidden> writes:

    Mark> I would generalize this to say that the trust router should
    Mark> ignore any dot-files.

At least in Debian and Ubuntu, a lot of thought has gone into the
problem of figuring out what files to ignore in configuration
directories.
The behavior of run-parts with the --lsbsysinit option seems to be our
best guess after several years working on this:

       If neither the --lsbsysinit option nor the --regex option is
       given then
              the names must consist entirely of ASCII upper- and
       lower-case letters,
              ASCII digits, ASCII underscores, and ASCII minus-hyphens.

                     If the --lsbsysinit option is given, then the
                     names must not end in
                            .dpkg-old or .dpkg-dist or .dpkg-new or
                     .dpkg-tmp, and must belong to
                            one or more of the following namespaces:
                     the LANANA-assigned namespace
                            (^[a-z0-9]+$); the LSB hierarchical
                     and reserved namespaces
                            (^_?([a-z0-9_.]+-)+[a-z0-9]+$); and the
                     Debian cron script namespace
                            (^[a-zA-Z0-9_-]+$).

There may be some RPM suffixes to exclude as well.

Revision history for this message
Adam Bishop (adam-omega) wrote :

RPM will create *.rpmnew and *.rpmsave filesas appropriate - both should be ignored.

Revision history for this message
Jennifer Richards (jennifer-k) wrote :

What is the desired behavior?

I have a fix that follows the run-parts --lsbsysinit convention Sam quoted, with ".cfg" added to the end of the namespaces described. (That requirement implicitly avoids files with the .dpkg-* and .rpm* suffixes.)

This is a somewhat restrictive naming convention---e.g., capital letters are excluded except in the Debian cron script namespace. Is that ok or desirable? It'd be easy enough to do a simpler check in the same spirit. E.g., restricting the first character to an alphanumeric or underscore.

Can someone with a better sense for how these are named in practice offer a suggestion?

Revision history for this message
Stefan Paetow (stefan-paetow) wrote :

Is it prudent to simply ignore dot-files?

Revision history for this message
Jennifer Richards (jennifer-k) wrote :

Certainly that is the simplest approach that eliminates the original bug.

Revision history for this message
Jennifer Richards (jennifer-k) wrote :

For now, I'm making the minimal change that resolves this bug report (rejecting config files that begin with an ASCII '.' character). Existing behavior already avoids reading config files with various package manager-specific extensions.

Revision history for this message
Jennifer Richards (jennifer-k) wrote :

Fix committed (commit 1e1cb0013d476900080a556bc1ba3c0b1ddfaa33).

Changed in moonshot-tr:
status: Confirmed → Fix Committed
Changed in moonshot-tr:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.