ionic-team / ionic-team/ionic-cli

Call to os.userInfo can lead to uncaught SystemError

Aberta
#4,438 3 comentários 0 reações 0 responsáveis Ver no GitHub
bug
Linguagem predominante
TypeScript
Estrelas
2k
Forks
681
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

**Description:**
Somewhere during releases the following code has been introduced in a release:
https://github.com/ionic-team/ionic-cli/commit/53d0afaea8966f7742220896a98da570c706fb63#diff-7c6997f05d0c3a730c4dd717afb61024
The problem I encounter is that in some cases the call to `os.userInfo();` can lead to a `SystemError` if the username or homedirectory is not returned by the OS as described here: https://nodejs.org/api/os.html#os_os_userinfo_options For me this is the case when running the ionic-cli in a Docker container using the `--user` parameter to specify a custom UID.

**Steps to Reproduce:**
Run the command `npx ionic build --prod --verbose` inside a docker container using the `--user` Docker argument to specify a specific UID.

**Output:**
```
ionic:utils-terminal Environment variables for CI detected: BUILD_ID, BUILD_NUMBER
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
```

**My `ionic info`:**
Command can not run due to the aforementioned error. This was tested with the @ionic/cli latest package and is reproducible from latest until version 5.4.7 where the code was introduced. Also the exception is thrown by all modern Node versions.

**Possible solution:**
As the method contains multiple methods of detecting a usable shell. It might be proficient to simply catch the exception and carry on using one of the following detection methods to determine the shell.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece pela chamada a os.userInfo() introduzida pelo release no caminho de detecção do shell e reproduza-a com npx ionic build --prod --verbose dentro de um contêiner Docker usando --user. Verifique os fallbacks existentes da detecção do shell e confirme que a ausência de um nome de usuário do OS ou de um diretório home não produza mais um SystemError não capturado.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
docker, node.js, typescript
Domínio
cli
Tipo de issue
Bug
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
42/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.