Commit Graph

5953 Commits

Author SHA1 Message Date
Alex Schroeder
ca259d46bd meta.t: remove -T from the syntax check
When testing it on my system, perl -c claims ban-contributors.pl is
good and perl -cT claims ban-contributors.pl bad because it can no
longer find Net/Whois/Parser.pm in @INC even though it's right there
as /home/alex/perl5/lib/perl5/Net/Whois/Parser.pm -- apparently taint
checking changes @INC.
<http://perldoc.perl.org/perlsec.html#Taint-mode-and-%40INC>.
2016-07-27 14:01:51 +02:00
Alex Schroeder
5b0e4aea6b meta.t: suggest the use of perl -cT 2016-07-27 13:56:11 +02:00
Alex Schroeder
a22117dd12 ban-contributors: switch to Net::Whois::Parser
This one is available in a Debian package.
2016-07-27 12:51:47 +02:00
Alex Schroeder
ad7e83b8fb ban-contributors: fixed failing meta.t tests 2016-07-26 09:37:20 +02:00
Alex Schroeder
2c6f0f0c59 ban-contributors: better regexp
Now able to handle the range 77.56.180.0 - 77.57.70.255.
2016-07-26 09:25:58 +02:00
Alex Schroeder
524dda2e64 Document the number range being banned 2016-07-26 09:10:22 +02:00
Alex Schroeder
80f7c0eea8 ban-contributors.pl now with Net::Whois::IP
We use a whois query to suggest a regular expression that bans the
entire network, not just a single IP.
2016-07-25 15:37:34 +02:00
Alex Schroeder
7ad11d3520 NamespacesInitVariables not decoding path_info
On a new server with Debian Jessie (8), Apache 2.4, Perl 5.25.1 and CGI
4.28 I'm getting double-decoded namespaces. An Umlaut will thus turn
into an undisplayable character (a questionmark in a black diamond).
Decoding of path_info was necessary on my old server with Debian
Wheezy (7), Apache 2.2, Perl 5.14.2 and CGI 3.52.

If you're still in the unfortunate situation, you can copy the old
implementation of NamespacesInitVariables into your config file.
2016-07-25 09:03:33 +02:00
Alex Schroeder
efba127e1f GetId no longer decodes path_info
On a new server with Debian Jessie (8), Apache 2.4, Perl 5.25.1 and
CGI 4.28 I'm getting double-decoded page names. An Umlaut will thus
turn into an undisplayable character (a questionmark in a black
diamond). Decoding of path_info was necessary on my old server with
Debian Wheezy (7), Apache 2.2, Perl 5.14.2 and CGI 3.52.

If you're still in the unfortunate situation, you can copy the old
implementation of GetId into your config file:

sub GetId {
  my $id = UnquoteHtml(GetParam('id', GetParam('title', ''))); # id=x or title=x -> x
  if (not $id and $q->keywords) {
    $id = decode_utf8(join('_', $q->keywords)); # script?p+q -> p_q
  }
  if ($UsePathInfo and $q->path_info) {
    my @path = map { decode_utf8($_) } split(/\//, $q->path_info);
    $id ||= pop(@path); # script/p/q -> q
    foreach my $p (@path) {
      SetParam($p, 1);    # script/p/q -> p=1
    }
  }
  return $id;
}
2016-07-21 12:49:01 +02:00
Alex Schroeder
91aa2773eb translation-links.pl: test with locked wiki, too 2016-07-09 00:07:32 +02:00
Alex Schroeder
ef7c5a2f10 translation-links.pl: prevent spam from saving
When using banned-regexps.pl, we want to ban certain pages from getting
created. This only works if we test source and target page for spam.
2016-07-09 00:03:18 +02:00
Alex Schroeder
6b1ddfd315 DoPost will also test $id for banned content
If using banned-regexps.pl, testing the page title can be important.
2016-07-06 18:18:28 +02:00
Alex Schroeder
039fd1df6d Fix make release target 2016-07-06 18:14:47 +02:00
Alex Schroeder
7c9a1c60d4 Get rid of -r 2016-06-27 12:05:37 +02:00
Alex Schroeder
1557979b62 tarballs.pl: decode utf8 2016-06-24 12:29:19 +02:00
Alex Schroeder
94d6ce1435 tarballs.pl: a frontend to serve released files
There is a target in our Makefile to make a new release. This stores a
tarball with the appropriate release information in
https://oddmuse.org/releases. tarballs.pl offers an interface to serve
these files, or their individual member files, with a naive cache of
50 elements.

This is a Mojolicious application and is available here:
https://odddmuse.org/download
2016-06-23 23:41:41 +02:00
Alex Schroeder
b60f3d26c7 Script to serve tarballs 2016-06-23 18:33:42 +02:00
Alex Schroeder
20ee03cb40 Merge git.sv.gnu.org:/srv/git/oddmuse 2016-06-23 00:47:10 +02:00
Alex Schroeder
d6ca510499 meta.t: improve by skipping comments 2016-06-23 00:44:06 +02:00
Alex Schroeder
bc6266009e meta.t: improve by skipping comments 2016-06-23 00:38:23 +02:00
Alex Schroeder
fd18de2b9e Fix issues discovered by meta.t 2016-06-23 00:34:56 +02:00
Alex Schroeder
f9bf87753e meta.t: enforce file access rules 2016-06-23 00:31:52 +02:00
Alex Schroeder
2588e5e835 toc.pl: use ToString and don't double-decode
ToString now takes more arguments.
2016-06-22 16:24:07 +02:00
Alex Schroeder
678baec68b Moving modules from utf8::encode to encode_utf8 2016-06-22 15:37:04 +02:00
Alex Schroeder
9f135bfb7e test.pl: move to encode_utf8 as well 2016-06-22 14:54:52 +02:00
Alex Schroeder
47de199dd5 Moving from utf8::encode to encode_utf8 2016-06-22 14:43:28 +02:00
Alex Schroeder
7ca2d5eb3b Changing $foo/$bar to "$foo/$bar"
Why did this not cause a syntax error?
2016-06-19 15:56:34 +02:00
Alex Schroeder
cd14410ed2 latex.pl: Globbing nil requires double quotes to work 2016-06-19 15:55:46 +02:00
Alex Schroeder
e7b7aec76f opendir also requires bytes 2016-06-19 15:55:03 +02:00
Alex Schroeder
94b8a1c4d8 All open and tie calls need utf8::encode 2016-06-19 13:51:11 +02:00
Alex Schroeder
d30f701266 bsd_glob replaced with Glob 2016-06-19 11:55:58 +02:00
Alex Schroeder
116f1d1fcb tags.pl: Storable also needs bytes in filename 2016-06-19 00:10:39 +02:00
Alex Schroeder
46cb69a6c3 Use helper functions for accessing the file system
As we derive a lot of filenames from strings in UTF-8 encoded files, we
need to make sure that any filename that might might be set by a user –
including all the filenames containing a directory deriving from
$DataDir – are passed through utf8::encode. That is, every character
gets replaced with a sequence of one or more characters that represent
the individual bytes of the character and the UTF8 flag is turned off.

In other words, -d $DataDir might not work if $DataDir contains a UTF-8
encoded string. The solution is to use the following replacements:

-f $name            IsFile($name)
-e $name            IsFile($name)
-d $name            IsDir($name)
(stat($name))[9]    Modified($name)
-M $name            $Now - Modified($name)
-z $name            ZeroSize($name)
unlink $name        Unlink($name)
mkdir $name         CreateDir($name)
rmdir $name         RemoveDir($name)

(Using IsFile for -e is probably not ideal?)

If you don’t, and Oddmuse gets used with Mojolicious, and you use the
Namespaces Extension, and a namespace contains non-ASCII characters such
as ä, ö, or ü, these characters will end up as part of $DataDir and
trigger the problem.

I also wonder whether we should be using some other Perl library.
2016-06-17 14:49:34 +02:00
Alex Schroeder
3c21b039a7 Fix regular expression in Makefile
Unescaped left brace in regex is illegal in regex.
2016-06-16 09:43:08 +02:00
Alex Schroeder
f9bb2fd12b Skip pygmentize if the binary is not found 2016-06-15 15:07:15 +02:00
Alex Schroeder
d6dc089746 Tests rely on English output
Set environment variable to en_US.UTF-8.
2016-06-15 14:47:20 +02:00
Alex Schroeder
6705ab2bf0 test.pl: no warning about killing the server 2016-06-15 10:32:58 +02:00
Alex Schroeder
d9cf2e5add Merge branch 'master' of github.com:kensanata/oddmuse 2016-06-15 10:31:06 +02:00
Alex Schroeder
f5ae897dc7 Merge github.com:kensanata/oddmuse 2016-06-14 13:14:12 +02:00
Alex Schroeder
eb2da8c886 Make server.pl compatible with Alexine 2016-06-14 13:07:29 +02:00
Alex Schroeder
24cc566afd All access to the file system needs bytes!
All occurence of	tuns into
-f $name		IsFile($name)
-e $name		IsFile($name)
-d $name		IsDir($name)
(stat($name))[9]	Modified($name)
-M $name		$Now - Modified($name)
unlink $name		Unlink($name)
mkdir $name		CreateDir($name)
rmdir $name		RemoveDir($name)

This change is incomplete. All the modules also need to be changed.
The benefit of this change is that t/mojolicious-namespaces.t passes.
2016-06-13 22:28:52 +02:00
Alex Schroeder
5ef80a8210 Prevent warning by using 127.0.0.1
Using localhost leads to a warning on my Debian Wheezy system.
2016-06-12 22:29:49 +02:00
Alex Schroeder
f2af79a6b4 A test for Mojolicious + Namespaces
Currently this fails if the namespace contains non-ASCII characters.
This failing test has been wrapped in a TODO.
2016-06-12 22:24:23 +02:00
Alex Schroeder
c7695cf94c Use /wiki in $ScriptName for Mojolicious test 2016-06-12 21:26:18 +02:00
Alex Schroeder
677d60f691 Simplify Mojolicious server setup
Make sure the wiki log is written into the data directory.
2016-06-12 21:25:28 +02:00
Alex Schroeder
5a5e293e2d Simplify namespaces.pl initialization 2016-06-12 21:24:43 +02:00
Alex Schroeder
fc291fe67a Add test for Mojolicious server 2016-06-12 17:32:20 +02:00
Alex Schroeder
12a42dcc93 Move server starting code from atom.t to test.pl 2016-06-11 20:08:04 +02:00
Alex Schroeder
c656bd14ce Added a test for stuff/server.pl 2016-06-11 14:15:36 +02:00
Alex Schroeder
2009e65944 Fix typo: substring → substr 2016-06-05 18:00:01 +02:00