hg displays errors in pre-commit.d/20warn-problem-files

Bug #1115335 reported by Claudio Bley
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
etckeeper (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

After running aptitude, I got a slew of these error messages for all files inside of /etc/.hg

abort: path contains illegal component: .hg/store/data/bash__completion.d.hg/service.i
abort: path contains illegal component: .hg/store/data/bash__completion.d.hg/cabal.i
abort: path contains illegal component: .hg/store/data/bash__completion.d.hg/clisp.i
abort: path contains illegal component: .hg/store/data/bash__completion.d.hg/ipmitool.i
abort: path contains illegal component: .hg/store/data/bash__completion.d.hg/bittorrent.i
abort: path contains illegal component: .hg/store/data/bash__completion.d.hg/rcs.i
abort: path contains illegal component: .hg/store/data/bash__completion.d.hg/cvsps.i
abort: path contains illegal component: .hg/store/data/bash__completion.d.hg/mount.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/65-fonts-persian.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/_r_e_a_d_m_e.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/90-synthetic.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/10-antialias.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/45-latin.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/49-sansserif.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/65-nonlatin.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/70-no-bitmaps.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/30-metric-aliases.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/80-delicious.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/60-latin.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/30-urw-aliases.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/20-unhint-small-vera.conf.i
abort: path contains illegal component: .hg/store/data/fonts/conf.d.hg/53-monospace-lcd-filter.conf.i

Looking at /etc/etckeeper/pre-commit.d/20warn-problem-files I can see why:

line 13: hardlinks=$(find . -type f -not -links 1 -exec hg status {} \; | exclude_internal ) || true

For every file found, a new process is started, retrieving the status about a single file. Afterwards, an attempt is made at filtering out all the internal files belonging to the SCM itself.

Too bad error output is not written to stdout, so the entries are never filtered.

I suggest to change this line to:

hardlinks=$(find . -type f -not -links 1 | exclude_internal | xargs hg status -n ) || true

Effects:

1. does not start a new process for each file found
2. filters the files before asking Mercurial for the status
3. does not display a status prefix for each file (like it's done for git)

Changed in etckeeper (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Oliver (oliver-assarbad) wrote :

This affects me too. But only ever since 12.04. I'm trying to use LTS versions exclusively.

For now I am using bzr instead. It's not my preferred VCS, but it does the job and is apparently better maintained in conjunction with etckeeper.

Revision history for this message
Claudio Bley (cbley) wrote :

Thinking about this a bit more, it would be best to forget about the exclude_internal function in that file.

For one, it ignores all directories from different SCMs. This could be bad when I'm using bzr, but have .git directories... When I have ignored those files is a different story I think.

It also fails for filenames containing special characters, newline for example.

What about

find . '(' -path .hg -prune ')' -o -print0 | xargs -0r hg status -n

Revision history for this message
Laurent Voisin (lvoisin-inf) wrote :

I've spent two hours this morning chasing this bug.

The cause that triggered the bug was that the /etc repository had been cloned by a sysadmin to another directory in the same filesystem. Therefore, to save space, Mercurial had made hardlinks on almost all the files in the repository thus triggering a line

  abort: path contains illegal component

for each file in the Mercurial repository.

The last patch seems perfect to me.

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.