4

I'm trying to create a directory in my home directory but the shell itself keeps crashing. I have permission to write to the directory. I am able to create files in the directory via touch. I can create directories in csh. When I try with bash, I get a fairly large core dump (~59M), but because bash is the binary the backtrace is not very helpful (just lots of "execute_command_internal()" calls). The name of the directory I'm creating doesn't seem to matter. I can try in other directories and I get the same strange behavior. I can use su to emulate another user who can create directories in my directory (once I've set the permissions to allow that), but I can't do it myself without bash crashing. I have tried rebooting the machine.

I am really baffled. Does anyone have any thoughts on what this could be or further things I can do to troubleshoot it?

Xubuntu 14.04, Bash 4.3.11(1)-release

EDIT: BASHOPTS=checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:histappend:interactive_comments:login_shell:progcomp:promptvars:sourcepath

The command is just mkdir a or something similar.

EDIT 2:

ldd /bin/mkdir yields:

linux-vdso.so.1 =>  (0x00007ffff55fd000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fadc606a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fadc5ca4000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fadc5a65000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fadc5861000)
/lib64/ld-linux-x86-64.so.2 (0x00007fadc62ab000)
  • 1
    Is your system up to date? Try sudo apt-get update followed by installing any out of date packages. Close and reopen the shell. If that does not work, try making a new user with a fresh shell and have that user make a directory in his own home directory. – nixeagle Sep 23 '14 at 22:46
  • @nixeagle - yes, it's up to date (fresh install as of yesterday). Closing and opening the shell won't work as I've already crashed the shell repeatedly, so I've had to open a new one each time. New user can create directories with no problems anywhere. – William Everett Sep 23 '14 at 22:50
  • 2
    I am willing to suspect your problem has to do with a custom .bashrc or other shell customization. A new user would have none of that. If so, could you include the custom scripts, if not make a new user and post BASHOPTS and any other relevant environment variables. – nixeagle Sep 23 '14 at 22:56
  • @nixeagle - I'm an idiot. I migrated some bash functions from another machine including a custom mkdir that was missing a variable. If you want to put something about not being a dumbass as an answer, I will accept it. – William Everett Sep 23 '14 at 23:02
  • 1
    Since you solved your own problem, go ahead and answer your own question :). Cheers! – nixeagle Sep 23 '14 at 23:04
4

I'm an idiot.

I had copied a bash function from somewhere that looked like this:

md() 
{
    [ $# -eq 0 ] && { echo "$0 dirname [permissions]"; return; }
    [ -d "$1" ] && { echo "%1 already exists!"; return; }
    mkdir -m ${2:-0755} -p "$1"
}

Problem was that I had previously had an alias like alias md="mkdir" so when bash parsed the new bash function, it expanded the md() to mkdir() and the function became infinitely recursive and crashed the shell.

  • 1
    you are not an idiot – kouty Aug 30 '16 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.