Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaks tab expansion of xsel -o -b #154

Closed
cstrahan opened this issue Oct 27, 2014 · 5 comments
Closed

breaks tab expansion of xsel -o -b #154

cstrahan opened this issue Oct 27, 2014 · 5 comments

Comments

@cstrahan
Copy link

Trying to expand $(xsel -o -b) results in xsel: fstat error on stdin: Bad file descriptor.

See also: zsh-users/zsh-history-substring-search#13

@danielshahaf
Copy link
Member

Minimal reproduction:

$ zsh -f
% autoload compinit && compinit
% f() { builtin zle .expand-or-complete } ; zle -N f; bindkey ^T f 
% echo $(xsel -o -b)<^T>
xsel: fstat error on stdin: Bad file descriptor

(It fails without the autoload too, but possibly for a different reason; see issue #185.)

Inspecting the Thingy::widget objects for f and for expand-or-complete, I find:

(gdb) p *th
$1 = {next = 0x7ffff604c930 <thingies+10160>, nam = 0x6f7e60 "f", flags = 0, 
  rc = 2, widget = 0x707be0, samew = 0x6f7da0}
(gdb) p th->widget->flags
$2 = 0
⋮
(gdb) p *th
$1 = {next = 0x0, nam = 0x7ffff5e3e8c1 "expand-or-complete", flags = 0, 
  rc = 4, widget = 0x7ffff6048b50 <widgets+2000>, 
  samew = 0x7ffff604c728 <thingies+9640>}
(gdb) p th->widget->flags
$2 = 2565

Where 2565 is the bitwise-or of:

#define WIDGET_INT      (1<<0)  /* widget is internally implemented */
#define ZLE_MENUCMP     (1<<2)  /* DON'T invalidate completion list */
#define ZLE_KEEPSUFFIX  (1<<9)  /* DON'T remove added suffix */
#define ZLE_ISCOMP      (1<<11) /* usable for new style completion */

I suspect this is another instance of the flags problem described at #150 (comment).

@danielshahaf
Copy link
Member

Minimal reproduction:

$ zsh -f
% autoload compinit && compinit
% f() { builtin zle .expand-or-complete } ; zle -N f; bindkey ^T f 
% echo $(xsel -o -b)<^T>
xsel: fstat error on stdin: Bad file descriptor

The following fixes the minimal example:

f() { zle .expand-or-complete }; zle -C f expand-or-complete f ; bindkey ^T f

@danielshahaf
Copy link
Member

@danielshahaf
Copy link
Member

@danielshahaf
Copy link
Member

Fixed in xsel three years ago: kfish/xsel#22.

I'm going to go ahead and close this. If anyone runs into this and needs a workaround, use the feature/redrawhook branch. If that isn't good enough, speak up. :)

danielshahaf added a commit that referenced this issue Aug 9, 2020
The parent commit, which merged the feature/redrawhook bug and thereby
closed PR #749, also fixed the following issue:

Fixes #40.

Fixes #90, closes #470. (The latter is a PR for the former.)

Fixes #150, closes #151, closes #160. (The latter two are PR's for the first one.) The related issue #183 appears to have been fixed in master. For #150, a different fix for older versions of zsh was considered but has not been implemented.

Issue #154 was fixed in xsel(1) in 2017. The parent commit probably fixed that issue for pre-2017 xsel(1).

Is #245, #356, and #749. Fixes #245 (redrawhook umbrella issue).

Does not reintroduce #257 (comment).

Does not reintroduce #259 (comment)

Closes #281 as obsolete.

Fixes #295.

Fixes #324.

Fixes #375.

Fixes #377.

Closes #421 as obsolete.

Fixes #520.

Unblocks #536 (already milestoned).

Fixes #632.

Unblocks #635. Milestoned.

Unblocks #688. Milestoned.

Unblocks administrative issue #655 (already milestoned).

(The above is copied from
#749 (comment),
but repeated here for the sake of github's commit-to-issue linking magic.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants