Show More
@@ -225,6 +225,12 b' class hgweb(object):' | |||
|
225 | 225 | # resolve file patterns relative to repo root |
|
226 | 226 | r.ui.setconfig('ui', 'forcecwd', r.root, 'hgweb') |
|
227 | 227 | r.baseui.setconfig('ui', 'forcecwd', r.root, 'hgweb') |
|
228 | # it's unlikely that we can replace signal handlers in WSGI server, | |
|
229 | # and mod_wsgi issues a big warning. a plain hgweb process (with no | |
|
230 | # threading) could replace signal handlers, but we don't bother | |
|
231 | # conditionally enabling it. | |
|
232 | r.ui.setconfig('ui', 'signal-safe-lock', 'false', 'hgweb') | |
|
233 | r.baseui.setconfig('ui', 'signal-safe-lock', 'false', 'hgweb') | |
|
228 | 234 | # displaying bundling progress bar while serving feel wrong and may |
|
229 | 235 | # break some wsgi implementation. |
|
230 | 236 | r.ui.setconfig('progress', 'disable', 'true', 'hgweb') |
@@ -841,13 +841,59 b' no style can be loaded from directories ' | |||
|
841 | 841 | |
|
842 | 842 | fall back to default |
|
843 | 843 | |
|
844 | $ killdaemons.py | |
|
845 | ||
|
846 | Test signal-safe-lock in web and non-web processes | |
|
847 | ||
|
848 | $ cat <<'EOF' > disablesig.py | |
|
849 | > import signal | |
|
850 | > from mercurial import error, extensions | |
|
851 | > def disabledsig(orig, signalnum, handler): | |
|
852 | > if signalnum == signal.SIGTERM: | |
|
853 | > raise error.Abort(b'SIGTERM cannot be replaced') | |
|
854 | > try: | |
|
855 | > return orig(signalnum, handler) | |
|
856 | > except ValueError: | |
|
857 | > raise error.Abort(b'signal.signal() called in thread?') | |
|
858 | > def uisetup(ui): | |
|
859 | > extensions.wrapfunction(signal, b'signal', disabledsig) | |
|
860 | > EOF | |
|
861 | ||
|
862 | by default, signal interrupt should be disabled while making a lock file | |
|
863 | ||
|
864 | $ hg debuglock -s --config extensions.disablesig=disablesig.py | |
|
865 | abort: SIGTERM cannot be replaced | |
|
866 | [255] | |
|
867 | ||
|
868 | but in hgweb, it isn't disabled since some WSGI servers complains about | |
|
869 | unsupported signal.signal() calls (see issue5889) | |
|
870 | ||
|
871 | $ hg serve --config extensions.disablesig=disablesig.py \ | |
|
872 | > --config web.allow-push='*' --config web.push_ssl=False \ | |
|
873 | > -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
|
874 | $ cat hg.pid >> $DAEMON_PIDS | |
|
875 | ||
|
876 | $ hg clone -q http://localhost:$HGPORT/ repo | |
|
877 | $ hg bookmark -R repo foo | |
|
878 | ||
|
879 | push would fail if signal.signal() were called | |
|
880 | ||
|
881 | $ hg push -R repo -B foo | |
|
882 | pushing to http://localhost:$HGPORT/ | |
|
883 | searching for changes | |
|
884 | no changes found | |
|
885 | exporting bookmark foo | |
|
886 | [1] | |
|
887 | ||
|
888 | $ rm -R repo | |
|
889 | $ killdaemons.py | |
|
890 | ||
|
844 | 891 | errors |
|
845 | 892 | |
|
846 | 893 | $ cat errors.log |
|
847 | 894 | |
|
848 | 895 | Uncaught exceptions result in a logged error and canned HTTP response |
|
849 | 896 | |
|
850 | $ killdaemons.py | |
|
851 | 897 | $ hg serve --config extensions.hgweberror=$TESTDIR/hgweberror.py -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
852 | 898 | $ cat hg.pid >> $DAEMON_PIDS |
|
853 | 899 |
General Comments 0
You need to be logged in to leave comments.
Login now