Go to file
Uli Schlachter 1408e8b952 Unset object's metatable in __gc
Run the following code:

  do
      local d
      local f = function() d.visible = true end
      if _VERSION >= "Lua 5.2" then
          setmetatable({}, { __gc = f })
      else
          getmetatable(newproxy(true)).__gc = f
      end
      d = drawin({})
  end
  collectgarbage("collect")

Awesome will segfault.

The reason for this is that after the above code ran, all variables in it are
unreferenced and will be garbage-collected at the next sweep phase. Lua runs
garbage collectors in the inverse order that their corresponding objects were
"marked" which means for the above code that the drawin's garbage collector will
run before function f runs. So the code will access the drawin after its
destructor already ran. Obviously, awesome's C code does not expect nor
correctly deal with this situation and was dereferencing a NULL pointer.

To fix this, this commit "unsets" the metatable of a userdata object when it is
being garbage collected. Since the type of a userdata is inferred via its
metatable, the object will no longer be accepted by luaA_toudata().

For the above code this will result in an unhelpful error message saying that
something tried to index a userdata, but userdata cannot be indexed. At least we
no longer crash and the traceback of the error will hopefully point at some __gc
metamethod which should be enough of a hint to figure out the problem.

Thanks-to: http://blog.reverberate.org/2014/06/beware-of-lua-finalizers-in-c-modules.html
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-06-20 12:33:17 +02:00
build-tests use CMake check_function_exists() for execinfo 2010-10-11 22:52:20 +02:00
build-utils Improve git-version-stamp's error messages 2015-06-10 19:41:48 +02:00
common Unset object's metatable in __gc 2015-06-20 12:33:17 +02:00
docs doc: improve doc for key.key and awful.key 2015-06-19 20:59:14 +02:00
icons icons: remove invaders 2009-09-08 13:29:25 +02:00
lib Merge pull request #265 from blueyed/doc-improve-key 2015-06-19 16:09:26 -04:00
manpages Remove F1-9 bindings from the manpages. 2013-03-10 11:22:35 +01:00
objects Screen __index: Don't turn argument into a string 2015-06-13 11:18:47 +02:00
spec spec: fix "require" statements for busted 2.0.rc6 2015-02-19 12:13:53 +01:00
themes Add a new tag layout: corner 2015-06-12 02:18:07 +02:00
utils Remove all traces of awsetbg and wallpaper setters 2012-07-29 15:38:31 +02:00
.gitignore gitignore: remove awesome-client 2009-04-11 16:10:42 +02:00
.travis.yml Travis: 'make build' for luarocks 2015-06-13 16:40:54 +02:00
CMakeLists.txt Support for XKB - changing keyboard layouts 2015-05-28 23:20:17 +02:00
LICENSE chance license to GPLv2 2007-09-12 14:29:51 +02:00
Makefile Makefile: distclean is a phony target 2014-08-23 22:09:17 +02:00
README.md Add README.md symlink 2015-02-28 23:14:13 +01:00
awesome-version-internal.h.in cmake: consolidate version strings 2008-06-22 22:13:06 +02:00
awesome.c Support for XKB - changing keyboard layouts 2015-05-28 23:20:17 +02:00
awesome.desktop Remove NoDisplay from desktop file 2013-02-25 11:50:00 +01:00
awesome.doxygen.in doc: remove obsolete doxygen settings 2015-02-14 18:54:36 +01:00
awesome.h remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
awesomeConfig.cmake Support for XKB - changing keyboard layouts 2015-05-28 23:20:17 +02:00
awesomerc.lua.in Add a new tag layout: corner 2015-06-12 02:18:07 +02:00
banning.c doc: fix warnings from doxygen 2015-02-14 20:17:13 +01:00
banning.h Clean up header includes 2014-03-30 20:07:48 +02:00
color.c Clean up header includes 2014-03-30 20:07:48 +02:00
color.h remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
config.h.in test for __builtin_clz() and fallback to an inline implementation. 2010-10-11 20:42:03 +02:00
dbus.c doc: fix warnings from doxygen 2015-02-14 20:17:13 +01:00
dbus.h remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
draw.c Merge pull request #142 from psychon/check-cairo-setup 2015-02-18 21:37:56 +01:00
draw.h Test if cairo-xcb is usable during startup 2015-02-18 21:23:47 +01:00
event.c Fix incorrect behavior when modkey is pressed 2015-05-28 23:20:17 +02:00
event.h Clean up header includes 2014-03-30 20:07:48 +02:00
ewmh.c Merge pull request #122 from blueyed/fix-ldoc-doxygen-warnings 2015-02-15 11:49:50 +01:00
ewmh.h Clean up header includes 2014-03-30 20:07:48 +02:00
globalconf.h Support for XKB - changing keyboard layouts 2015-05-28 23:20:17 +02:00
keygrabber.c Less reloading of keymap, fixes from psychon comments 2015-05-28 23:20:17 +02:00
keygrabber.h Clean up header includes 2014-03-30 20:07:48 +02:00
luaa.c xkb: implementation of keyboard layout switched 2015-03-03 00:33:16 +03:00
luaa.h awesome: Add startup signal 2015-02-14 15:41:11 +01:00
mouse.c lua: Use pushinteger for int type 2015-05-26 01:09:12 -04:00
mouse.h Revert "Support more than 5 mouse buttons" (FS#1082) 2013-03-29 16:07:13 +01:00
mousegrabber.c Clean up header includes 2014-03-30 20:07:48 +02:00
mousegrabber.h Revert "Support more than 5 mouse buttons" (FS#1082) 2013-03-29 16:07:13 +01:00
property.c Merge pull request #122 from blueyed/fix-ldoc-doxygen-warnings 2015-02-15 11:49:50 +01:00
property.h Clean up header includes 2014-03-30 20:07:48 +02:00
root.c doc: fix typos with root.c and beautiful 2015-06-19 21:04:17 +02:00
selection.c Clean up header includes 2014-03-30 20:07:48 +02:00
selection.h remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
spawn.c Set &error in parse_command, return it from luaA_spawn 2015-03-31 01:17:45 +02:00
spawn.h Clean up header includes 2014-03-30 20:07:48 +02:00
stack.c doc: fix warnings from doxygen 2015-02-14 20:17:13 +01:00
stack.h Clean up header includes 2014-03-30 20:07:48 +02:00
strut.c remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
strut.h remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
systray.c Hide globalconf.L 2014-12-06 11:56:58 +01:00
systray.h remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
xkb.c Xkb setup by calling xkbcommon function 2015-05-28 23:20:17 +02:00
xkb.h Less reloading of keymap, fixes from psychon comments 2015-05-28 23:20:17 +02:00
xwindow.c minor: formatting 2015-03-28 22:17:45 +01:00
xwindow.h Clean up header includes 2014-03-30 20:07:48 +02:00

README.md

Readme

About awesome

awesome is a highly configurable, next generation framework window manager for X.

Building and installation

After extracting the dist tarball, run:

make

This will create a build directory, run cmake in it and build awesome.

After building is finished, you can install:

make install  # you might need root permissions

Running awesome

You can directly select awesome from your display manager. If not, you can add the following line to your .xinitrc to start awesome using startx or to .xsession to start awesome using your display manager:

exec awesome

In order to connect awesome to a specific display, make sure that the DISPLAY environment variable is set correctly, e.g.:

DISPLAY=foo.bar:1 exec awesome

(This will start awesome on display :1 of the host foo.bar.)

Configuration

The configuration of awesome is done by creating a $XDG_CONFIG_HOME/awesome/rc.lua file.

An example configuration named awesomerc.lua.in is provided in the source.

Troubleshooting

In most systems any message printed by awesome (including warnings and errors) are written to $HOME/.xsession-errors.

If awesome does not start or the configuration file is not producing the desired results the user should examine this file to gain insight into the problem.

Reporting issues

Please report any issues you may find on our bugtracker. You can submit pull requests on the github repository. Please read the @{02-contributing.md} guide for any coding, documentation or patch guidelines.

Status

Build Status

License

The project is licensed under GNU General Publice License v2 or later. You can read it online at (v2 or v3).