forked from Airblader/i3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2935 from orestisf1993/issue-2934
Make sure that parse_config input terminates with '\0'
- Loading branch information
Showing
3 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!perl | ||
# vim:ts=4:sw=4:expandtab | ||
# | ||
# Please read the following documents before working on tests: | ||
# • http://build.i3wm.org/docs/testsuite.html | ||
# (or docs/testsuite) | ||
# | ||
# • http://build.i3wm.org/docs/lib-i3test.html | ||
# (alternatively: perldoc ./testcases/lib/i3test.pm) | ||
# | ||
# • http://build.i3wm.org/docs/ipc.html | ||
# (or docs/ipc) | ||
# | ||
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf | ||
# (unless you are already familiar with Perl) | ||
# | ||
# Make sure that configs that end without a newline don't crash i3. | ||
# Ticket: #2934 | ||
use i3test i3_autostart => 0; | ||
|
||
my $first_lines = <<'EOT'; | ||
set $workspace1 workspace number 1 | ||
set $workspace0 workspace eggs | ||
bindsym Mod4+1 $workspace1 | ||
EOT | ||
|
||
# Intentionally don't add a trailing newline for the last line since this is | ||
# what triggered the bug. | ||
my $last_line = 'bindsym Mod4+0 $workspace0'; | ||
my $config = "${first_lines}${last_line}"; | ||
|
||
my $pid = launch_with_config($config); | ||
does_i3_live; | ||
|
||
my $i3 = i3(get_socket_path()); | ||
my $ws = $i3->get_workspaces->recv; | ||
is($ws->[0]->{name}, 'eggs', 'last line processed correctly'); | ||
|
||
exit_gracefully($pid); | ||
done_testing; |