Giter Site home page Giter Site logo

martanne / abduco Goto Github PK

View Code? Open in Web Editor NEW
732.0 732.0 52.0 619 KB

abduco provides session management i.e. it allows programs to be run independently from its controlling terminal. That is programs can be detached - run in the background - and then later reattached. Together with dvtm it provides a simpler and cleaner alternative to tmux or screen.

License: ISC License

Makefile 3.97% C 74.08% Shell 11.94% Roff 10.02%

abduco's People

Contributors

evhan avatar larsks avatar luke-clifton avatar martanne avatar phillid avatar quibo avatar rpmohn avatar waldyrious avatar yiyus avatar zsugabubus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

abduco's Issues

ssh -t abduco

abduco often has problems when called in this way: ssh host -t abduco -A irc weechat
First, if I'm creating a new session, it never works. I get a blank screen and I need to kill the abduco process to recover.
Attaching to an existing session works most of the time, but sometimes has rendering issues, and has failed to properly attach at least once (blank screen, must kill abduco).

[Request] Key to become controlling size

I access one abduco session (for irc) from many different computers, using persistent connections (like mosh). I frequently run into the problem where a different terminal is controlling the size, and I must reconnect to resize the terminal.

A keybind which does this on the fly would be appreciated.

Thanks!

get current session

I'm using FreeBSD 12.2 & macOS 11.2, both w/ fish shell.

I would like to know the current session's name and socket.

I found issue #33 but I don't have these env variables on either system.

Licensing

It looks like there is code originally written in "dtach" included in abduco. (Analysis is here: https://bugs.debian.org/cgi-bin/bugreport.cgi?archive=no&bug=771102, I reproduced it locally and confirmed)

dtach (http://dtach.sourceforge.net/) is open source, licensed under the GPL, so this fact in and of itself is not an issue, but what is a problem is that neither the copyright notice of dtach nor the license for that code is included in abduco. Abduco is otherwise licensed ISC, a permissive license which is compatible with the GPL.

Your options for resolving this are:

  • Ask the dtach copyright holder for permission to use their code under the ISC license (and properly include the copyright notice for dtach in abduco).
  • Include dtach copyright notice and licensing in abduco as is. This would effectively change the license on dtach when compiled to be GPL, even if your unique code is still ISC (ISC + GPL = GPL)
  • Relicense abduco under the same license as dtach, GPL (and properly include the copyright notice for dtach in abduco).
  • You could purchase the copyrights for dtach. (I'm including this for completeness, i am not really suggesting this as a viable option)

Fedora currently includes abduco, and wishes to continue to do so, however, we also want to respect the copyright and license of dtach. Our hope is that you can resolve this to make the situation clear for everyone.

Implicit passthru breaks no-option listing behavior

The passthru flag is set when stdin is not a tty. Doing this breaks the default no-option behavior to list sessions in the case where stdin is not a tty.

Perhaps the implicit passthru should be set only when stdin is not a tty and command-line arguments are present.

Attachment/Detachment is not working propertly

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.2 (jessie)
Release:    8.2
Codename:   jessie
$ wget https://github.com/martanne/abduco/archive/v0.4.tar.gz
$ tar xf v0.4.tar.gz
$ cd abduco-0.4
$ make
$ ./abduco -c hello htop

1

--- CTRL-\ ---

$ ./abduco
Active sessions (on host corei3)
$ ./abduco -a hello

2
3

Race condition between EOF & MSG_EXIT

Run abduco -c abc sh, then echo $$ > pid and detach.
Kill sh: kill $(cat pid), then run: echo | abduco -a abc.

Sometimes, it reads the EOF before the server can respond MSG_EXIT.

Can't list sessions when using -e

I have an alias set in my .bashrc as
alias abduco='abduco -e ^Qq'
because of this I can't list sessions anymore. Any workarounds?

-f

abduco -f -n <session> can result in create-session: Address already in use if you kill the underlying process of an abduco session.

Conflict with CMUS

I love to use Abduco to send my CMUS session away from me, but when I do, I'll encounter a bug upon my return to CMUS. The bug goes like this: the keybindings don't quite work as expected, i.e, the left and right arrows cause deletion of albums from my list if they are pressed enough.

Session missing after restart

When restart my system cant find the session.
The socket is also missing.
I use abduco + dvtm and setting $ABDUCO_SOCKET_DIR to ${XDG_CONFIG_HOME:-$HOME/.config}/abduco.
I installed abduco by cloning and following build instructions
I don't know if this is an intended feature

Set an environment variable with the session name/socket.

I use abduco without dvtm, and have on average four to five sessions going. It would be nice if I could see which session I'm currently in at the shell prompt. Currently, the best way I can think of is to hack around with ps and $PPID, but that is hard to make portable, and has me parsing an abduco CLI call.

The suggestion would be for abduco to automatically set, for example, an ABDUCO_SESSION and/or ABDUCO_SOCKET environment variable for each session.

Buffer corruption with dvtm and kakoune

I am running abduco -> dvtm -> kakoune (the text editor) and find my buffer systematically corrupted.
This seems to be happening as I move the cursor down the buffer: kakoune displays the line number in its status bar, and as well in the title of the terminal. As the cursor passes a 10-modulo boundary the original buffer text scrolls up by one line, including the dvtm tags at the top. The only way to fix this is by pressing C-g C-l to get dvtm to redraw the screen.

This does not happen if:

  • I recompile dvtm not to set the term title (term_title_handler)
  • I run dvtm and kakoune without abduco.

I got a similar issue just running less, but only once and I am unable to reproduce this.

I use the Chrome Secure Shell ssh client, but confirmed the same issue with urxvt.

$SRC used by CRUX Linux distro's `pkgmk`, causing conflict

Hey, just wanted to let you know that both abduco's and dvtm's Makefiles use the $SRC variable.

This variable is used by the pkgmk command in CRUX, so it causes this conflict: http://sprunge.us/NTVK

I fixed by adding the following to the Pkgfile before using make:

sed -i "s/SRC/SSRC/g" Makefile

One of the guys at CRUX already came up with a solution, but discussion ensuing suggests this is an edge case so changes are not necessary and/or not going to be made, the Pkgfile should just work around it.

Just thought you should know though, feel free to close this as soon as you read it. :)

P.S.: Probably should have just sent you an email, but whatever, what's been done is done. :P

"^[[1;3C" at the end of the session names

I noticed that abduco was appending this string at the end of the file names, in ~/.abduco/.

$ abduco -c test
abduco: test: detached

$ ls ~/.abduco
'test@'$'\033''[1;3C'

This is not of a high importance, as everything works all the same.

Detatching/killing a session from the command line

I don't if this would be possible but it would be very neat to have a way to detach a session from the command line instead of by using key.

Similarly it would be very useful to kill a session from the command line.

Can't compile on OpenBSD

I'm switching to OpenBSD from Linux (CRUX), so sorry if this seems a little bit ignorant. When I run make I get several errors:

http://sprunge.us/HKgH

I was able to compile it successfully just a couple days ago on Linux which makes me believe it doesn't work because I'm on OpenBSD.

Is this something you can fix or is it something for me to fix on my end? BTW I'm on OpenBSD 5.6 (not -current).

Handle mouse events

It's possible it's user error on my part, but I don't seem to see any of the mouse events going through and don't see anything in the docs that suggest this feature is intentionally absent.

Active sessions depend on network connection on macOS

I spent some time figuring out something that puzzled me, so I thought I'd document it here.


The active sessions depended on the WiFi connection on macOS (Catalina // 10.15.7).

WiFi off:

abduco

# Active sessions (on host riccardos-MacBook-Pro.local)
#  Sat	 2021-07-10 22:55:29	bb
#  Fri	 2021-07-09 15:50:09	gif
#  Wed	 2021-07-07 11:40:27	ac
#  Wed	 2021-07-07 10:37:06	pz
#  Thu	 2021-06-17 14:37:40	on

WiFi connected to some network:

abduco
# Active sessions (on host riccardos-MBP.lan)

WiFi connected to some other network:

abduco
# Active sessions (on host Justynas-Air.localdomain)

I noticed that abduco uses gethostname and landed on an apple.stackexchange.com answer that explains what's going on:

If there's no HostName available, what you see is probably coming from the DNS or DHCP server.

You can check the current HostName with scutil --get HostName. Mine was HostName: not set.

After setting it with sudo scutil --set HostName 'yourHostName' I can see my sessions regardless of the network connection.

Happy to open a PR and document this somewhere if you find it useful. Otherwise, please feel free to close this 🙏

create-session: Inappropriate file type or format

I'm experiencing this on OpenBSD.

The error message in the title is happening because chmod(2) is returning EFTYPE at server.c:57:

if (r == -1 || chmod(sockaddr.sun_path, S_ISVTX|S_IRUSR|S_IWUSR) == -1) {
        close(fd);
        return -1;
}

This is because the sticky bit (S_ISVTX) is being set on a non-directory; removing the use of S_ISVTX avoids the issue and abduco functions normally.

According to both sticky(8) and chmod(2) on OpenBSD, doing this shouldn't be an issue, i.e., it's ignored, but that's evidently not the case given EFTYPE is returned. I assume you use Linux, where setting the sticky bit on sockets is actually ignored, at least according to the Wikipedia page.

Anyway, does it even make sense to set the sticky bit on sockaddr.sun_path, given it's apparently ignored? Did you mean to set it on dirname(sockaddr.sun_path) instead?

^4 detaches

Ctrl-4 works the same as Ctrl-\ on my system. I am uncertain if it is the same with other users. The distribution is NixOS-unstable with US keymap. What more information may I supply?

Programmatically send keys to session

I'm trying to replace tmux with dvtm+abduco, but I just realized that one of the features I use doesn't seem to be present in the latter solution.

With tmux, I'm able to send keypresses to a session without being attached to it with the tmux send-keys command. The command target is a session+window+pane but it seems like abduco doesn't know anything about windows/panes and dvtm doesn't know anything about sessions.

Is there a way to achieve this? Is it even feasible to implement something like this?

General issues with non-ncurses programs

Using abduco to manage sessions with ncurses programs works just fine. Things like nano or vim can be attached and detached etc without issue. However, since non-ncurses programs don't start printing on a fresh screen and abduco (directly or indirectly?) sets the cursor to the top left, any output from the programs gets mixed up with anything already on the screen. For example, running:

ls /
abduco -c test ls /

can result in something like:

bin   dev  home  lost+found  opt   root  sbin  sys  usr
boot  etc  libe  mntt+fo     proc  runt  srv   tmp  var
abduco: test: session terminated with exit status 0 var
$ abduco -c test ls /

I know you don't tend to detach ls, but it was the first, most common example I could think of. This is actually happening with wvdial for me, not ls. It's not much of an issue for me personally, as I don't tend to look at wvdial's output, but I can imagine it's not the way abduco is intended to make things look and it could potentially cause issues for others.

Changing the detach key isn't working.

I can't seem to change the detach key to CTRL+[anything other then \], it just flat out doesn't work, I've tried setting it from config.def.h also but no dice.

Preserve terminal state across sessions

abduco currently deliberately operates on the raw I/O byte stream and does not try interpret any communication happening between the supervised program and the attached terminals.

As a consequence the terminal state is currently not preserved across detach/attach cycles. This is a deliberate design decision. To properly fix this another utility (e.g. dvtm(1)) which already keeps track of the terminal state would need to be notified when a session is re-attached (e.g. by means of a signal) and restore it accordingly.

I would like to eventually implement that, but it is currently not a high priority. Mostly because the use cases that I am interested in, work "good enough".

I hope that clarifies the reason for issues like #23, #26 and #31.

RFE: session timeout

It would be helpful to optionally have abduco perform an action after no input from the user for a configurable period of time. This could be either just a "session disconnect" action, or executing an alternative (configurable) command such as vlock. tmux has this feature, but I don't want any of the other stuff in tmux except session management.

detach not working on re-attach

Somehow I can't get the default CTRL+`\ to detach on my pc. If i remap to something else, it works (like CTRL+e). However, when I reattach to a session with -a , that no longer works (ill assume its back to default).

Feature request: Auto naming of sessions

Calling simply tmux from the terminal creates a session with a name (which is an integer starting from 0).

I use tmux for only one thing, keeping my sessions opened whatever happened to my terminal (except killed with ^D or exit of course). So when a terminal is opened, I run a script that check if there is an not-attached session, attach to it if exists, else create a new session.

Would it be possible to add an "auto-naming" mecanism when a new session is created instead of having to manually set it?

remote connection with local socket

first of all i really appreciate the effort you are putting into this.
so far abduco works as expected and isn't eating away cpu time on my arm board like tmux does.

back to the issue...
is there a way to "export" the local unix socket via tcp (with e.g. socat)?
i know this does not work well with tmux because it's using file descriptor passing, but how is the story here with abduco?

(abduco -n arm-box) <= unix-socket <--local--> tcp-socket <==remote==> tcp-socket <--local--> unix-socket => (abduco -a remote-arm-box)

maybe i did not use socat properly but the above hack was not working.

cheers, grafoo

Crash ( all session gone) after `:update<CR>`

Problem:
abduco: s_wf: session terminated with exit status 0

I use this:
abduco -A my_session1 nvim -c 'terminal' -c 'startinsert'
nvr -cc tabedit MY_file.any_type
abduco -A my_session2 nvim -c 'terminal' -c 'startinsert'
abduco -A my_session3 nvim -c 'terminal' -c 'startinsert'

sometimes, after pressing <c-s>, all sessions crash and are gone

v  <C-S>       * <C-C>:update<CR>
    Last set from ~/dotF/cfg/nvim/init.vim line 685
no <C-S>       * :update<CR>
    Last set from ~/dotF/cfg/nvim/init.vim line 683

i  <C-S>       * <C-O>:update<CR>
    Last set from ~/dotF/cfg/nvim/init.vim line 684

abduco -c foo bash, then mc

Run abduco -c foo bash, then run mc inside this bash.
The exit from mc.
You will see the terminal restored to state in which it was before running abduco.
This is bad.
It should be restored to state before running mc

XDG Base Directory Specification for session information

Seeing as ~/.abduco would store session information and stale sessions tend to happen, it may help to use $XDG_CACHE_HOME. Some benefits of that would be not being affected by errant $TMPDIR (used for increasing compilation code capacity etc.) and having a standard location based on the kind of user (temporary, roaming etc.). Later, cleaning scripts for $XDG_CACHE_HOME could help with removal of stale sessions across reboots. What do you think?

Follow Freedesktop's XDG base directory specification

For some reason, abduco is one of the applications that still clutters the home directory with session info in ~/.abduco folder. While there is a way to avoid this, by setting $ABDUCO_SOCKET_DIR (mentioned in #7 and pretty well documented on the top of the man page), this still isn't ideal.

Freedesktop's XDG Base Directory spec has been there for a long time, and there is no reason to disregard a well-established and known standard. The folder containing the session info should automatically be placed in one of the standard paths. I'm not entirely familiar with the kind of data stored in this location, however this is the simple description of the standard:

  • $XDG_DATA_HOME: Data that persists between application restarts and is needed for the app to work properly (things like databases)
  • $XDG_CONFIG_HOME: Configuration data that remains mostly static and is usually only read by the application, not directly modified by it.
  • $XDG_CACHE_HOME: Non-essential data that is expected to be removed by the user regularly.
  • $XDG_RUNTIME_DIR: Runtime file objects, such as sockets or named pipes. This directory will be removed once the user logs off.
  • $XDG_STATE_HOME: Data that should persist between application restarts, but it wouldn't be a huge issue if it got removed.

From my simple observations, you should follow the $XDG_RUNTIME_DIR, if this directory isn't available, the standard would be to fall back to /run/user/$UID

This should be made the default behavior since there is no reason to store these files in home whatsoever, it only clutters the directory and even though there is a way to go around it, there is no reason not to avoid following this standard by default. standard by default.

History

I don't use dvtm. I use just abduco to run some apps on a server.
Then I can deattach/reattach to the session and my app doesn't die.

These apps generally log just to stdout, they listen to some REST things and so on.
When I reattach I wanted to view some of the recent log lines.
Before that I used tmux, and it has some "history", but abduco doesn't print anything from the history.
dvtm isn't needed for my usecase, for this I don't need window tiling and so on.

Is there a way to run my apps and when I reattach to the session to view some history of the output?
Or I must log to a file?

Session still active after command terminated; connection refused

I was ssh'ed into an abduco session created with command "irssi", and irssi (or something in the ssh -> abduco -> irssi chain) stopped responding to input. I killed ssh, and when I reconnected I found that the abduco session was still "active" and displayed with an * in the session list, meaning that a client was considered to be still connected, even though no irssi process was running anymore. Trying to connect to the session resulted in the error message "attach session: Connection refused".

I haven't manually removed the socket yet, just in case there's still some debugging that could be done on it.

Output isn't redrawn when attaching to a session

This can be easily seen in a pager.

abduco -c man man man

Connecting the first time often works (but not always).

abduco -a man

However, upon re-attaching, the terminal is usually emtpy, and requires scrolling to actually redraw.

This isn't perfectly consistent. Sometimes, after restarting the terminal, it redraws the first time but not the second.

Various keys behaving funky (KEY_HOME, KEY_IC, etc.)

I had originally thought this was a dvtm problem, but I've now narrowed it to some code that is common between dtach and abduco. See this issue report.

Basically, if you set MOD to KEY_HOME in dvtm, and then launch one st and execute 'abduco -c test' and then launch a second st and execute 'abduco -a test', KEY_HOME, KEY_IC, KEY_DC, KEY_RIGHT, etc. won't get passed along (or get passed along as distinct key codes) in the second st.

You can reproduce this without dvtm, e.g., abduco -c test yash.

The same behavior occurs in dtach; hence I think it is some code common to dtach and abduco.

OS X/iTerm 2: abduco requires keyboard input after process ends to quit, pegs a CPU

Running master revision 586d751:

% abduco -v
abduco-0.5 © 2013-2015 Marc André Tanner

I create a new abduco session running an ephemeral process:

% abduco -c foo sh -c 'echo 'hello world''

The terminal goes blank, "hello world" is printed:

screen shot 2016-01-19 at 12 44 54 pm

At this point, abduco is using 99% CPU. If I press <RET> or something, then abduco quits. If I don't, then abduco survives even the closing of its terminal window and I have an annoying spinning process doing nothing but wasting battery life and cycles :-)

acknowledge parts of the code come from dtach

There is an interesting comparative analysis of dtach and abduco in the Debian bug #771102. In it, the dtach author makes a convincing argument that significant parts of abduco have been copied verbatim from dtach.

dtach is licensed under GPLv2, while abduco is licensed under ISC. If it is indeed the case that parts of dtach have been imported then rewritten in abduco, the license of abduco should recognize that, and should also be licensed under a GPLv2-compatible license.

this problem has led to abduco's removal from Debian, and its lack of updates in Ubuntu, and will prevent it from entering Debian again. I tried to update abduco myself in Debian, and was faced with similar license problems, in bug #833897.

Feature request: using abduco in a DUMB terminal

I was looking for something like TMUX that will work in a DUMB terminal (ie, Emacs shell buffer). It seems this isn't supported right now, there's some redrawing happening so that I don't see output of any command
screenshot 2017-11-02 22 55 09

Cannot scroll

Hello. I connect to machines with SSH, but sometimes my connection drops.
I like to resume my work after reconnect without loosing my session.

I don't have need for multiplexing or anything fancy, I just want to resume where I left of.
I found dtach and abduco to be fitting for my purpose.

However there is one big showstopper in abduco:
Whenever I am connected to an abduco session, scrolling appears to be disabled.
In dtach, scrolling keeps working.

Is there a workaround or fix for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.