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

fdisk: autocomplete for loading script file adds space to suggested filename #2838

Open
castilma opened this issue Mar 12, 2024 · 3 comments
Labels
TODO We going to think about it ;-)

Comments

@castilma
Copy link

How to reproduce:

$ echo foo >script.sfdisk
$ head -c 1K /dev/zero >img
$ fdisk img
## press I
## type script<Tab>
##  you should see script.sfdisk being suggested. press enter.

result:

Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS (MBR) disklabel with disk identifier 0x4656ec7a.

Command (m for help): I

Enter script file name: script.sfdisk 
Cannot open script.sfdisk : No such file or directory

Command (m for help): 

For this bad script file I expect:

Command (m for help): I 

Enter script file name: script.sfdisk 
Cannot open script.sfdisk: Invalid argument
@castilma
Copy link
Author

castilma commented Apr 22, 2024

A solution might be setting rl_completion_append_character to \0, or rl_completion_suppress_append to non-zero.

@karelzak
Copy link
Collaborator

Would you like to send a patch (pull request)?

@karelzak karelzak added the TODO We going to think about it ;-) label Apr 22, 2024
@castilma
Copy link
Author

I never programmed with readline. Can't be too difficult. Probably it belongs into one of the few HAVE_LIBREADLINE occurrences. I'll look in the next few days, whether I'm able to do that. If I don't respond after that, assume I couldn't do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO We going to think about it ;-)
Projects
None yet
Development

No branches or pull requests

2 participants