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

bash completion hangs/breaks on drush generate #5913

Closed
raffaelj opened this issue Mar 15, 2024 · 1 comment
Closed

bash completion hangs/breaks on drush generate #5913

raffaelj opened this issue Mar 15, 2024 · 1 comment

Comments

@raffaelj
Copy link

When pressing Tab key to use bash completion with drush generate it hangs in a weird state with 2 newlines and waiting for input:

dummy@05eaa6536073:/var/www$ drush --version
Drush Commandline Tool 12.4.4.0
dummy@05eaa6536073:/var/www$ drush generate 

^C
dummy@05eaa6536073:/var/www$

To Reproduce

  • create a docker image with drupal
  • enable bash completion
  • type drush gen, type Tab --> nothing happens
  • type drush gene, type Tab --> expands to drush generate as expected
  • terminal shows drush generate (with the whitespace at the end), type Tab again --> broken state
  • without the whitespace drush generate pressing Tab does nothing and nothing breaks

Expected behavior

Either nothing or displaying some possible arguments for completion.

Actual behavior

as mentioned above

Workaround

press CTRL+C to escape the trap

System Configuration

Q A
Drush version? 12.4.4
Drupal version? 10.2.4
PHP version 8.1.25
OS? Linux

Additional information

If this is not reproducable, my setup is the following:

$ docker --version                                      
Docker version 25.0.3-ce, build f417435e5

drupal docker image:

# Drupal docker image for local tests and development

# docker build -t raffaelj/drupal-php8.1-apache-dev:latest .

FROM raffaelj/php8.1-apache-dev:latest

# drush requires a text editor
RUN apt-get update \
    && apt-get install -y \
        nano vim

# change DOCUMENT_ROOT from /var/www/html to /var/www/web
ENV APACHE_DOCUMENT_ROOT /var/www/web
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

# make drush command available
ENV PATH="/var/www/vendor/bin:$PATH"

# install bash completion
RUN apt-get install -y bash-completion

# enable bash completion for drush (dummy user is installed via parent image)
RUN touch /home/dummy/.bashrc \
    && chown dummy /home/dummy/.bashrc \
    && echo 'source /etc/bash_completion' >> /home/dummy/.bashrc \
    && echo 'if command -v drush &> /dev/null; then source <(drush completion bash); fi' >> /home/dummy/.bashrc

# run apache
CMD ["apache2-foreground"]

base image:

# A basic image with php8.1, apache, SQLite, MySQL, image optimization tools and node/npm

# docker build -t raffaelj/php8.1-apache-dev:latest .

FROM php:8.1-apache

ARG UID="1000"

# install libs, image optimization tools and npm
RUN apt-get update \
    && apt-get install -y \
        wget zip unzip \
        libzip-dev \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libpng-dev \
        sqlite3 libsqlite3-dev \
        libssl-dev \
        libicu-dev \
        jpegoptim \
        optipng \
        pngquant \
        gifsicle \
        webp \
        npm \
    && docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
    && docker-php-ext-configure intl \
    && docker-php-ext-install -j$(nproc) iconv gd pdo zip opcache pdo_sqlite pdo_mysql intl exif \
    && a2enmod rewrite expires \
    && npm install -g svgo

# install imagemagick
RUN apt-get install -y libmagickwand-dev \
    && pecl install imagick \
    && docker-php-ext-enable imagick

# create home dir for dummy user, because npm needs a home directory
RUN useradd -u ${UID} dummy \
    && mkdir -p /home/dummy/.npm \
    && chown -R dummy /home/dummy

# install nodejs
# https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - \
    && apt-get install -y nodejs

# increase upload file size limit
RUN touch /usr/local/etc/php/conf.d/uploads.ini \
    && echo "upload_max_filesize = 256M;\npost_max_size = 256M;" >> /usr/local/etc/php/conf.d/uploads.ini

# increase memory_limit
RUN touch /usr/local/etc/php/conf.d/memory_limit.ini \
    && echo "memory_limit = 256M;" >> /usr/local/etc/php/conf.d/memory_limit.ini

# install composer
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer

# run apache
CMD ["apache2-foreground"]

docker-compose.yml:

version: '3.3'

name: test

services:
  drupal:
    image: raffaelj/drupal-php8.1-apache-dev
    user: 1000:1000
    container_name: test
    ports:
      - ${PORT:-127.0.0.1:8080}:80
    restart: always
    working_dir: /var/www
    sysctls:
      - net.ipv4.ip_unprivileged_port_start=0
    volumes:
      - ./:/var/www
@weitzman
Copy link
Member

Fixed in #5931

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants