Re: [dev] Possible improvement on slock - suid
On 2013-11-14 08:51:11 +0100, patrick295767 patrick295767 wrote: In my opinion, the lock (slock) shall be remain very light based a very minimum of x11, in other words just on the x11 minimum of x11 layer functions/libs Correctness before simplicity, always in that order. pgpOUKmWnz2cg.pgp Description: PGP signature
Re: [dev] Possible improvement on slock - suid
On Thu, Nov 14, 2013 at 08:51:11AM +0100, patrick295767 patrick295767 wrote: In my opinion, the lock (slock) shall be remain very light based a very minimum of x11, in other words just on the x11 minimum of x11 layer functions/libs slock might be a minimal x11 lock, without any additional features. Is actually getpwuid() really needed? slock function might be to simply lock x11 in the most simple manner. Furthermore, the user can anytime pkill slock from another tty. Have you actually looked at the code you complain about? It really is not adding any complexity. I'm pretty sure if the error message was something like 'Permission denied' you'd have never looked at it. The thing is, the existing error message is a lot more clear and to the point. Given that you need to type in your password to unlock it, implies that the proper checks should be in place in case it is unable to collect all the information needed to verify it. bye, sin
Re: [dev] Possible improvement on slock - suid
On Thu, Nov 14, 2013 at 08:51:11AM +0100, patrick295767 patrick295767 wrote: In my opinion, the lock (slock) shall be remain very light based a very minimum of x11, in other words just on the x11 minimum of x11 layer functions/libs [...] It seems you mistake suckless for the minimalism movement. Printing concise and to the point error messages is suckless. It makes the software discoverable by users and it does not incur relevant overhead. Removing things that you right now do not need, but that are still a not-stupid part of the software (like error checking, FFS), is not the same as producing suckless software. -- Gregor Best -- You do not have mail.
[dev] [slock] [patch] Set errno to 0 before getpwuid() and check it afterwards
Hi, Just a small fix. bye, sin From cf540c7f316619c728e921082abf5887de15ab93 Mon Sep 17 00:00:00 2001 From: sin s...@2f30.org Date: Thu, 14 Nov 2013 11:24:08 + Subject: [PATCH 1/2] Set errno to 0 before getpwuid() and check it afterwards --- slock.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slock.c b/slock.c index 467937c..506231e 100644 --- a/slock.c +++ b/slock.c @@ -65,8 +65,11 @@ getpw(void) { /* only run as root */ const char *rval; struct passwd *pw; + errno = 0; pw = getpwuid(getuid()); - if(!pw) + if (errno) + die(slock: getpwuid: %s\n, strerror(errno)); + else if (!pw) die(slock: cannot retrieve password entry (make sure to suid or sgid slock)\n); endpwent(); rval = pw-pw_passwd; -- 1.8.4.2
[dev] [slock] [patch] Add a tiny configure script for BSD and Linux systems
Hi all, This is similar to what we do with http://git.suckless.org/utmp. Take this with a grain of salt at the moment. There are some smaller fixes embedded in this commit and it might be wise to split those out. Second step is to split the ifdef'ed code out into bsd.c and linux.c or similar (and update the OBJ entries from the corresponding config.* files.) Let me know what you think. bye, sin
Re: [dev] [slock] [patch] Add a tiny configure script for BSD and Linux systems
On Thu, Nov 14, 2013 at 02:24:53PM +0200, sin wrote: Hi all, This is similar to what we do with http://git.suckless.org/utmp. Take this with a grain of salt at the moment. There are some smaller fixes embedded in this commit and it might be wise to split those out. Second step is to split the ifdef'ed code out into bsd.c and linux.c or similar (and update the OBJ entries from the corresponding config.* files.) Let me know what you think. Would be ideal to have attached the patch. From 75f8d2b6bc09e0125f07f2dacc226ab7242e0a8f Mon Sep 17 00:00:00 2001 From: sin s...@2f30.org Date: Thu, 14 Nov 2013 11:42:43 + Subject: [PATCH 2/2] Add a tiny configure script for BSD and Linux systems --- Makefile | 7 +-- config.bsd | 23 +++ config.linux | 23 +++ config.mk| 30 -- configure| 10 ++ 5 files changed, 61 insertions(+), 32 deletions(-) create mode 100644 config.bsd create mode 100644 config.linux delete mode 100644 config.mk create mode 100755 configure diff --git a/Makefile b/Makefile index 2bea555..2bf78e5 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ # slock - simple screen locker # See LICENSE file for copyright and license details. +# slock version +VERSION=1.2 + include config.mk SRC = slock.c @@ -40,8 +43,8 @@ install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin @mkdir -p ${DESTDIR}${PREFIX}/bin @cp -f slock ${DESTDIR}${PREFIX}/bin - @chmod 755 ${DESTDIR}${PREFIX}/bin/slock - @chmod u+s ${DESTDIR}${PREFIX}/bin/slock + @chgrp ${GROUP} ${DESTDIR}${PREFIX}/bin/slock + @chmod ${MODE} ${DESTDIR}${PREFIX}/bin/slock uninstall: @echo removing executable file from ${DESTDIR}${PREFIX}/bin diff --git a/config.bsd b/config.bsd new file mode 100644 index 000..afbc825 --- /dev/null +++ b/config.bsd @@ -0,0 +1,23 @@ +# Customize below to fit your system + +# paths +PREFIX = /usr/local + +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib + +# includes and libs +INCS = -I${X11INC} +LIBS = -L${X11LIB} -lX11 -lXext + +# flags +CPPFLAGS = -DVERSION=\${VERSION}\ -DHAVE_BSD_AUTH -DCOLOR1=\black\ -DCOLOR2=\\#005577\ +CFLAGS += ${INCS} ${CPPFLAGS} +LDFLAGS += ${LIBS} + +# compiler and linker +CC = cc + +# install mode +MODE=2755 +GROUP=auth diff --git a/config.linux b/config.linux new file mode 100644 index 000..41bfe4f --- /dev/null +++ b/config.linux @@ -0,0 +1,23 @@ +# Customize below to fit your system + +# paths +PREFIX = /usr/local + +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib + +# includes and libs +INCS = -I. -I/usr/include -I${X11INC} +LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext + +# flags +CPPFLAGS = -DVERSION=\${VERSION}\ -DHAVE_SHADOW_H -DCOLOR1=\black\ -DCOLOR2=\\#005577\ +CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} +LDFLAGS = -s ${LIBS} + +# compiler and linker +CC = cc + +# install mode +MODE=4755 +GROUP=root diff --git a/config.mk b/config.mk deleted file mode 100644 index 8cc3f68..000 --- a/config.mk +++ /dev/null @@ -1,30 +0,0 @@ -# slock version -VERSION = 1.2 - -# Customize below to fit your system - -# paths -PREFIX = /usr/local - -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib - -# includes and libs -INCS = -I. -I/usr/include -I${X11INC} -LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext - -# flags -CPPFLAGS = -DVERSION=\${VERSION}\ -DHAVE_SHADOW_H -DCOLOR1=\black\ -DCOLOR2=\\#005577\ -CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} -LDFLAGS = -s ${LIBS} - -# On *BSD remove -DHAVE_SHADOW_H from CPPFLAGS and add -DHAVE_BSD_AUTH -# On OpenBSD and Darwin remove -lcrypt from LIBS - -# compiler and linker -CC = cc - -# Install mode. On BSD systems MODE=2755 and GROUP=auth -# On others MODE=4755 and GROUP=root -#MODE=2755 -#GROUP=auth diff --git a/configure b/configure new file mode 100755 index 000..82db20d --- /dev/null +++ b/configure @@ -0,0 +1,10 @@ +#!/bin/sh + +case $(uname) in +*BSD) + ln config.bsd config.mk + ;; +*) + ln config.linux config.mk + ;; +esac \ No newline at end of file -- 1.8.4.2
[dev] [sbase] [patch] Always print the program name
Hi, Generally very useful - consider going through a configure script or similar that bombs out because of an unimplemented option. This provides a quick indication as to which program actually failed. We should probably default to that. bye, sin From ec613aeea190bdd9330bdf6394e51df519bb1118 Mon Sep 17 00:00:00 2001 From: sin s...@2f30.org Date: Thu, 14 Nov 2013 13:06:48 + Subject: [PATCH] Always print the program name This is generally very useful for sbase, especially when we hit some case that is not implemented and we want to know which program failed. --- util/eprintf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/eprintf.c b/util/eprintf.c index 4b12902..c878e81 100644 --- a/util/eprintf.c +++ b/util/eprintf.c @@ -33,7 +33,7 @@ enprintf(int status, const char *fmt, ...) void venprintf(int status, const char *fmt, va_list ap) { - /*fprintf(stderr, %s: , argv0);*/ + fprintf(stderr, %s: , argv0); vfprintf(stderr, fmt, ap); @@ -50,6 +50,8 @@ weprintf(const char *fmt, ...) { va_list ap; + fprintf(stderr, %s: , argv0); + va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); -- 1.8.3.4
Re: [dev] Possible improvement on slock - suid
Me, I do believe that slock shall be targeting the aim of this program: 1) lock x11. Ok, look my example, think about a student behind the rules of the admin. In an ideal case, he compiles the slock, and he locks and it really works. In the present case, he compile, and it crashes since he shall ask the root pwd of the school /fix permissions (and improves his last grades in physics, informatics, by the way) ;) _- I quickly look the code before compiling, but I must say I shall look in further details to fix this code. 2013/11/14 Chris Down ch...@chrisdown.name: On 2013-11-14 08:51:11 +0100, patrick295767 patrick295767 wrote: In my opinion, the lock (slock) shall be remain very light based a very minimum of x11, in other words just on the x11 minimum of x11 layer functions/libs Correctness before simplicity, always in that order.
Re: [dev] IRC on Free node
what about activating your ssh server only when you need it? You could even activate it via mobile phone (e.g. SMS to your box), and stop your ssh the same way. Exotic ssh port is a very good way to avoid already a good deal of brute attempts. The ssh activation another way to make the box without attempts, but likely possible if it is for an several users such as an University, school,... 2013/11/3 FRIGN d...@frign.de: On Sun, 3 Nov 2013 19:08:16 +0800 Chris Down ch...@chrisdown.name wrote: If you do this, you should make sure that you run on a port 1024, though, otherwise someone could find some way to make your daemon crash and masquerade as it (which is still protected a little assuming that your SSH host key is not readable to them, but still). Thanks a lot for the info! I always run my daemon on port 1337. Seems like the days of cool port numbers are over, at least when it comes to SSH :/. Next up: port 666. Cheers FRIGN -- FRIGN d...@frign.de
Re: [dev] Possible improvement on slock - suid
On 2013-11-14 15:46:23 +0100, patrick295767 patrick295767 wrote: Me, I do believe that slock shall be targeting the aim of this program: 1) lock x11. Lock X11 *in a correct fashion*. pgpQa2d9WxsBQ.pgp Description: PGP signature
Re: [dev] Possible improvement on slock - suid
Hi Patrick, On 11/14/13, patrick295767 patrick295767 patrick295...@gmail.com wrote: Ok, look my example, think about a student behind the rules of the admin. Then you must appeal to the administrator(s) and provide the source so that they may review it and install it. just the same way they've installed other X11 screen locking apps that also have suid/guid set. --Carlos
[dev] [st][patch] use int instead of long for color
Hi, here is a patch that replaces long with int. It saves some memory on 64bit systems. Regards, Johannes diff --git a/st.c b/st.c index fda7044..51ecd21 100644 --- a/st.c +++ b/st.c @@ -179,9 +179,9 @@ typedef unsigned short ushort; typedef struct { char c[UTF_SIZ]; /* character code */ - ushort mode; /* attribute flags */ - ulong fg;/* foreground */ - ulong bg;/* background */ + ushort mode; /* attribute flags */ + uint fg; /* foreground */ + uint bg; /* background */ } Glyph; typedef Glyph *Line; @@ -379,7 +379,7 @@ static void tsetdirtattr(int); static void tsetmode(bool, bool, int *, int); static void tfulldirt(void); static void techo(char *, int); -static long tdefcolor(int *, int *, int); +static int tdefcolor(int *, int *, int); static void tselcs(void); static void tdeftran(char); static inline bool match(uint, uint); @@ -1666,9 +1666,9 @@ tdeleteline(int n) { tscrollup(term.c.y, n); } -long +int tdefcolor(int *attr, int *npar, int l) { - long idx = -1; + int idx = -1; uint r, g, b; switch (attr[*npar + 1]) { @@ -1717,7 +1717,7 @@ tdefcolor(int *attr, int *npar, int l) { void tsetattr(int *attr, int l) { int i; - long idx; + int idx; for(i = 0; i l; i++) { switch(attr[i]) {
Re: [dev] [st][patch] use int instead of long for color
On Thu, Nov 14, 2013 at 04:09:08PM +0100, Johannes Hofmann wrote: Hi, here is a patch that replaces long with int. It saves some memory on 64bit systems. If you want 32 bits use uint32_t, in other case I will not apply the patch. -- Roberto E. Vargas Caballero
Re: [dev] [st] why is Glyph.fg, Glyph.bg long?
On Wed, Nov 13, 2013 at 01:03:47PM +, Thorsten Glaser wrote: Roberto E. Vargas Caballero dixit: long, because long is at least 32 bits for sure, but int can be only 16 On POSIX, int is a minimum 32 bit data type. I prefer follow the ISO rules about data sizes. Regards, -- Roberto E. Vargas Caballero
Re: [dev] Possible improvement on slock - suid
With 20'000 students including 9000 graduates and about 50 research laboratories, each year, believe me that you will not get any support for anything from the admin of the machines. I already asked or tried, and to get any support for similar things, such as installation of a software on a specific machine. You get your Linux box, and if you wanna use a specific program you always can compile to your local. Permission fix for it is likely not possible / thinkable. Although on most machines, there is xscreensaver, but why not using slock? The slock app is though not installed. 2013/11/14 Carlos Torres vlaadbr...@gmail.com: Hi Patrick, On 11/14/13, patrick295767 patrick295767 patrick295...@gmail.com wrote: Ok, look my example, think about a student behind the rules of the admin. Then you must appeal to the administrator(s) and provide the source so that they may review it and install it. just the same way they've installed other X11 screen locking apps that also have suid/guid set. --Carlos
Re: [dev] Possible improvement on slock - suid
On Thu, Nov 14, 2013 at 4:44 PM, patrick295767 patrick295767 patrick295...@gmail.com wrote: You get your Linux box, and if you wanna use a specific program you always can compile to your local. Luckily, suckless software is generally easy to patch. Which means you can ship your own version (to yourself for your uni machine) and compile patched source. You can even distribute and advertise the changes! (But not every patch will be upstreamed.) Cheers, -- __ Raphaël Proust
[dev] Desktop warping for DWM?
Hi, For instance, I have been using during years fluxbox, and I must say that there was one feature (one out of many) that was interesting to be used. - It is called Desktop Warping What is it? - From the flux man page, it has been indicated as follows: When desktop warping is enabled, dragging a window outside the desktop will change to the next desktop. I hope that it describes it well. Would you appreciate to have this feature (patch) on DWM? I have tried to find a video on Youtube about desktop warping feature (- to illustrate this better), but unfortunately I could not find any relevant one. Best wishes and Good evening, Pat
Re: [dev] [st] why is Glyph.fg, Glyph.bg long?
Roberto E. Vargas Caballero dixit: On Wed, Nov 13, 2013 at 01:03:47PM +, Thorsten Glaser wrote: Roberto E. Vargas Caballero dixit: long, because long is at least 32 bits for sure, but int can be only 16 On POSIX, int is a minimum 32 bit data type. I prefer follow the ISO rules about data sizes. That is stupid because this is a POSIX application and will not work without POSIX stuff anyway. If you want 32 bits use uint32_t, in other case I will not apply the patch. The idea here is that “int” is faster than either “long” or “int32_t” – the former is for specific cases where int is not enough, and the latter will be forcibly 32-bit even if int is 64 bit on some machines where this is faster. You could use “int_fast32_t” if you’re so pedantic. But just using “int” here is probably the right thing to do. bye, //mirabilos -- „Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund, mksh auf jedem System zu installieren.“ -- XTaran auf der OpenRheinRuhr, ganz begeistert (EN: “[…]uhr.gz is a reason to install mksh on every system.”)
Re: [dev] Desktop warping for DWM?
Hi Patrick, Quoth patrick295767 patrick295767: When desktop warping is enabled, dragging a window outside the desktop will change to the next desktop. I hope that it describes it well. Would you appreciate to have this feature (patch) on DWM? I know the feature. It doesn't sound that useful for dwm users, because I doubt many of us routinely move windows by dragging anyway, and assigning windows to different tags is pretty fast and straightforward providing you're comfortable doing window management from a keyboard. Also of course the paradigm of having multiple tags per window is broken somewhat by this, as is selecting multiple tags. If I have a window in tag 2 tag 3, and I currently have tags 3 4 active, and I 'warp' the window, what tag should it get? 3? 4? 5? I know some people don't use tags this way, though.
Re: [dev] Desktop warping for DWM?
For a primarily tiling window manager that encourages the use of a keyboard over a mouse and uses the concept of tags rather than multiple desktops… “desktop warping” seems awful.
Re: [dev] Desktop warping for DWM?
because I doubt many of us routinely move windows by dragging anyway, Oh, I forgot to add it into my original post since we rarely use the mouse actually. I though about it to write it, but I finally did not mention it. thanks for notice/add-on 2013/11/14 Nick suckless-...@njw.me.uk: Hi Patrick, Quoth patrick295767 patrick295767: When desktop warping is enabled, dragging a window outside the desktop will change to the next desktop. I hope that it describes it well. Would you appreciate to have this feature (patch) on DWM? I know the feature. It doesn't sound that useful for dwm users, because I doubt many of us routinely move windows by dragging anyway, and assigning windows to different tags is pretty fast and straightforward providing you're comfortable doing window management from a keyboard. Also of course the paradigm of having multiple tags per window is broken somewhat by this, as is selecting multiple tags. If I have a window in tag 2 tag 3, and I currently have tags 3 4 active, and I 'warp' the window, what tag should it get? 3? 4? 5? I know some people don't use tags this way, though.
Re: [dev] Desktop warping for DWM?
indeed. Completely correct. I would anyhow have tried to receive a short survey / feedback if some of us, - dwm user, might eventually find it as nice to have or might be eventually useful for the dwm... just curious 2013/11/14 Ryan O’Hara rni...@gmail.com: For a primarily tiling window manager that encourages the use of a keyboard over a mouse and uses the concept of tags rather than multiple desktops… “desktop warping” seems awful.
Re: [dev] Desktop warping for DWM?
Greetings. On Thu, 14 Nov 2013 18:47:31 +0100 patrick295767 patrick295767 patrick295...@gmail.com wrote: indeed. Completely correct. I would anyhow have tried to receive a short survey / feedback if some of us, - dwm user, might eventually find it as nice to have or might be eventually useful for the dwm... just curious Your proposal seems to be just eye‐candy. It is not needed. Sincerely, Christoph Lohmann
Re: [dev] Desktop warping for DWM?
On Thu, Nov 14, 2013 at 5:02 PM, patrick295767 patrick295767 patrick295...@gmail.com wrote: […] Would you appreciate to have this feature (patch) on DWM? dwm doesn't have “desktop”s. dwm has tags (by default 9 of them, although editing config.h can change that) and views (only 2: the current view and the alternate view). See http://www.wongdev.com/blog/2013/01/24/dwm-tags-are-not-workspaces/ for details. Can you explain your feature request using the proper dwm vocabulary? (Such an explanation could serve as a base for an actual discussion.) Cheers, -- __ Raphaël Proust
[dev] [ANNOUNCE] togs-0.3 (was stem)
Hi, I've renamed stem to togs so that it no longer conflicts with the Tor stem project, https://stem.torproject.org/ . I'm hopeful that the new togs name will work and will not cause too much agitation. In order to keep your settings the same: 1) exit out of all current stem sessions 2) mv ~/.stem ~/.togs 3) mv ~/.togs/stemrc ~/.togs/togsrc Togs remains a small shell script (sloccount200) that combines dvtm, the console based tiling window manager, with the dtach utility to create an easy to use and powerful terminal emulation manager with the ability to Toggle between Sessions. You can run many sessions simultaneously, disconnect and leave them running in the background, connect to them again later, even allow others to attach for collaboration or training purposes. http://waxandwane.org/togs.html Cheers! Ross -- Ross Palmer Mohn http://waxandwane.org/
Re: [dev] [st] why is Glyph.fg, Glyph.bg long?
That is stupid because this is a POSIX application and will not work without POSIX stuff anyway. I don't like use words like stupid, because some times it can change the sense of the discussion. I agree with you that it is a POSIX application, and you can be sure it is not going to be reduced to ISO compatibility. But it is not the issue; I like more the ISO sizes because they are better defined. The idea here is that “int” is faster than either “long” or “int32_t” – the former is for specific cases where int is not enough, and the latter will be forcibly 32-bit even if int is 64 bit on some machines where this is faster. I thought you were talking about the waste of space due to 32/64 bits, but you are now talking about speed. First at all, how do you know that int is not going to be 64 bits? ILP64 or SILP64 uses int of 64 bits, and the speed improvement you are going to gain is near to 0, because these variables are only used a few of times, so they are not a bottle neck. The only reason why I am going to accept change the type is because we can save a lot of memory (well in my case is 3*4*239*73 = 204K). And, other question, how do you know that using a int instead of a int32_t you are going to have a speed improvement?, maybe the memory reduction makes your code commit less cache fails, and your code begin to fly because you use int32_t instead of int. Stop of guessing and do some test in your machine, and if the results are good, then repeat the tests in other machine with other architecture, and maybe we will begin to talk about this issue. using “int” here is probably the right thing to do. I am sorry, but I don't agree with you in this point. -- Roberto E. Vargas Caballero
Tags as tags (Was: [dev] Desktop warping for DWM?)
On 11/14/13 at 05:57pm, Raphaël Proust wrote: dwm doesn't have “desktop”s. dwm has tags (by default 9 of them, although editing config.h can change that) and views (only 2: the current view and the alternate view). See http://www.wongdev.com/blog/2013/01/24/dwm-tags-are-not-workspaces/ for details. I've been referred to that blog post before, and I find it interesting and useful. But what it probably is not is a description of the way dwm was meant to be used or some such. The fact that the poster recommends changing the default keybindings so as to promote treating tags as tags provides evidence of this, I think: if the poster's way of thinking of dwm tags was the intended way, their preferred keybindings would have been the default keybindings. Manolo
Re: Tags as tags (Was: [dev] Desktop warping for DWM?)
On 2013-11-14 22:13:53 +0100, Manolo Martínez wrote: I've been referred to that blog post before, and I find it interesting and useful. But what it probably is not is a description of the way dwm was meant to be used or some such. The fact that the poster recommends changing the default keybindings so as to promote treating tags as tags provides evidence of this, I think: if the poster's way of thinking of dwm tags was the intended way, their preferred keybindings would have been the default keybindings. What's that line from Apollo 13 again? I don't care what it was designed to do, I only care what it *can* do, or something? :-) I think it very much depends on your workflow. For my work, I find thinking of the tags as separate desktops is usually the way that I end up using them (occasionally I display multiple tags at the same time, but I don't think of that as being something I do regularly). I think that's mostly, perhaps, since my aggression in cleaning up unneeded clients has increased in recent times (although that's also helped by limiting myself to 4 tags (dev, web, communication, hotfix)). I'm not averse to either tags-as-tags or tags-as-desktops. Do what makes sense for your situation. I'm not even sure what I do, since I seem to do both. pgpq6XjviQBIm.pgp Description: PGP signature