Mercurial > hg
annotate doc/Makefile @ 46607:e9901d01d135
revlog: add a mechanism to verify expected file position before appending
If someone uses `hg debuglocks`, or some non-hg process writes to the .hg
directory without respecting the locks, or if the repo's on a networked
filesystem, it's possible for the revlog code to write out corrupted data.
The form of this corruption can vary depending on what data was written and how
that happened. We are in the "networked filesystem" case (though I've had users
also do this to themselves with the "`hg debuglocks`" scenario), and most often
see this with the changelog. What ends up happening is we produce two items
(let's call them rev1 and rev2) in the .i file that have the same linkrev,
baserev, and offset into the .d file, while the data in the .d file is appended
properly. rev2's compressed_size is accurate for rev2, but when we go to
decompress the data in the .d file, we use the offset that's recorded in the
index file, which is the same as rev1, and attempt to decompress
rev2.compressed_size bytes of rev1's data. This usually does not succeed. :)
When using inline data, this also fails, though I haven't investigated why too
closely. This shows up as a "patch decode" error. I believe what's happening
there is that we're basically ignoring the offset field, getting the data
properly, but since baserev != rev, it thinks this is a delta based on rev
(instead of a full text) and can't actually apply it as such.
For now, I'm going to make this an optional component and default it to entirely
off. I may increase the default severity of this in the future, once I've
enabled it for my users and we gain more experience with it. Luckily, most of my
users have a versioned filesystem and can roll back to before the corruption has
been written, it's just a hassle to do so and not everyone knows how (so it's a
support burden). Users on other filesystems will not have that luxury, and this
can cause them to have a corrupted repository that they are unlikely to know how
to resolve, and they'll see this as a data-loss event. Refusing to create the
corruption is a much better user experience.
This mechanism is not perfect. There may be false-negatives (racy writes that
are not detected). There should not be any false-positives (non-racy writes that
are detected as such). This is not a mechanism that makes putting a repo on a
networked filesystem "safe" or "supported", just *less* likely to cause
corruption.
Differential Revision: https://phab.mercurial-scm.org/D9952
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Wed, 03 Feb 2021 16:33:10 -0800 |
parents | eb9026a84e83 |
children | dc101c236219 |
rev | line source |
---|---|
43736
640bae94f2f3
cleanup: update references to /help/ that should now be /helptext/
Augie Fackler <augie@google.com>
parents:
42058
diff
changeset
|
1 SOURCES=$(notdir $(wildcard ../mercurial/helptext/*.[0-9].txt)) |
671
efa4a7e2f322
Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents:
465
diff
changeset
|
2 MAN=$(SOURCES:%.txt=%) |
efa4a7e2f322
Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents:
465
diff
changeset
|
3 HTML=$(SOURCES:%.txt=%.html) |
12921
6b6e7da9bccd
doc/Makefile: docs now also depend on extensions
Martin Geisler <mg@aragost.com>
parents:
12841
diff
changeset
|
4 GENDOC=gendoc.py ../mercurial/commands.py ../mercurial/help.py \ |
43736
640bae94f2f3
cleanup: update references to /help/ that should now be /helptext/
Augie Fackler <augie@google.com>
parents:
42058
diff
changeset
|
5 ../mercurial/helptext/*.txt ../hgext/*.py ../hgext/*/__init__.py |
2233 | 6 PREFIX=/usr/local |
4030
a48971ae1387
install man pages by default into $(PREFIX)/share/man not $(PREFIX)/man since the FHS puts them there
Jonathan Smith <https://issues.rpath.com/>
parents:
3908
diff
changeset
|
7 MANDIR=$(PREFIX)/share/man |
44721
eb9026a84e83
make: drop the `-c` arg to `install` in the documentation makefile
Matt Harbison <matt_harbison@yahoo.com>
parents:
43736
diff
changeset
|
8 INSTALL=install -m 644 |
42058
ec7b478f1bf8
packaging: allow to run make with python3
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents:
41850
diff
changeset
|
9 PYTHON?=python |
13054
25200c7efe0f
runrst: add RSTARGS Makefile variable to allow customization
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12921
diff
changeset
|
10 RSTARGS= |
465 | 11 |
19427
80983af366b5
doc: make i18n man and html
Takumi IINO <trot.thunder@gmail.com>
parents:
19426
diff
changeset
|
12 export HGENCODING=UTF-8 |
9971
fa99480d5135
doc/Makefile: ensure C locale
Martin Geisler <mg@lazybytes.net>
parents:
9703
diff
changeset
|
13 |
1006
b0e581438835
Generate html documentation by default, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
671
diff
changeset
|
14 all: man html |
465 | 15 |
16 man: $(MAN) | |
17 | |
18 html: $(HTML) | |
19 | |
41850
d80d48928eb1
setup: define build_doc command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
34622
diff
changeset
|
20 # This logic is duplicated in setup.py:hgbuilddoc() |
19426
e43184680461
doc: make man and html from translated documents
Takumi IINO <trot.thunder@gmail.com>
parents:
19425
diff
changeset
|
21 common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt): $(GENDOC) |
34622
b584ed1b225d
build: make install in "/doc" failed if the destination dir contained spaces
muxator <a.mux@inwind.it>
parents:
19427
diff
changeset
|
22 ${PYTHON} gendoc.py "$(basename $@)" > $@.tmp |
9444
2f7f6e43d52b
doc/Makefile: do not create files in case of errors
Martin Geisler <mg@lazybytes.net>
parents:
9422
diff
changeset
|
23 mv $@.tmp $@ |
1814
7956893e8458
generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1689
diff
changeset
|
24 |
19426
e43184680461
doc: make man and html from translated documents
Takumi IINO <trot.thunder@gmail.com>
parents:
19425
diff
changeset
|
25 %: %.txt %.gendoc.txt common.txt |
13054
25200c7efe0f
runrst: add RSTARGS Makefile variable to allow customization
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12921
diff
changeset
|
26 $(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \ |
9445
f0105f2c424c
doc/Makefile: make rst2html and rst2man halt on warnings
Martin Geisler <mg@lazybytes.net>
parents:
9444
diff
changeset
|
27 --strip-elements-with-class htmlonly $*.txt $* |
465 | 28 |
19426
e43184680461
doc: make man and html from translated documents
Takumi IINO <trot.thunder@gmail.com>
parents:
19425
diff
changeset
|
29 %.html: %.txt %.gendoc.txt common.txt |
13054
25200c7efe0f
runrst: add RSTARGS Makefile variable to allow customization
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12921
diff
changeset
|
30 $(PYTHON) runrst html $(RSTARGS) --halt warning \ |
9626
d1aa5393bef4
doc: add a style sheet to the generated HTML pages
Martin Geisler <mg@lazybytes.net>
parents:
9445
diff
changeset
|
31 --link-stylesheet --stylesheet-path style.css $*.txt $*.html |
465 | 32 |
3872
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
33 MANIFEST: man html |
9401
2a5144687727
doc/Makefile: Don't show Makefile comments in output
Mads Kiilerich <mads@kiilerich.com>
parents:
9400
diff
changeset
|
34 # tracked files are already in the main MANIFEST |
3872
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
35 $(RM) $@ |
12841
5fbc2c38a98f
doc/Makefile: do not include hg.1.gendoc.txt in MANIFEST
Martin Geisler <mg@lazybytes.net>
parents:
12840
diff
changeset
|
36 for i in $(MAN) $(HTML); do \ |
3872
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
37 echo "doc/$$i" >> $@ ; \ |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
38 done |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3269
diff
changeset
|
39 |
2233 | 40 install: man |
41 for i in $(MAN) ; do \ | |
8822
1027da7d2fb9
doc: fix regexp for determining the man page section
Cédric Duval <cedricduval@free.fr>
parents:
8311
diff
changeset
|
42 subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \ |
34622
b584ed1b225d
build: make install in "/doc" failed if the destination dir contained spaces
muxator <a.mux@inwind.it>
parents:
19427
diff
changeset
|
43 mkdir -p "$(DESTDIR)$(MANDIR)"/$$subdir ; \ |
b584ed1b225d
build: make install in "/doc" failed if the destination dir contained spaces
muxator <a.mux@inwind.it>
parents:
19427
diff
changeset
|
44 $(INSTALL) $$i "$(DESTDIR)$(MANDIR)"/$$subdir ; \ |
2233 | 45 done |
46 | |
465 | 47 clean: |
19426
e43184680461
doc: make man and html from translated documents
Takumi IINO <trot.thunder@gmail.com>
parents:
19425
diff
changeset
|
48 $(RM) $(MAN) $(HTML) common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt) MANIFEST |