Skip to content

Update environment variable handling and clean up debug statements#85

Merged
NaBuchholz merged 6 commits intomainfrom
dev
Jul 13, 2025
Merged

Update environment variable handling and clean up debug statements#85
NaBuchholz merged 6 commits intomainfrom
dev

Conversation

@NaBuchholz
Copy link
Owner

Refactor the code to improve environment variable handling and remove unnecessary debug print statements. Update the Makefile to eliminate test targets.

Copilot AI review requested due to automatic review settings July 13, 2025 21:34
@NaBuchholz NaBuchholz self-assigned this Jul 13, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors how environment variables are managed—shifting to operate directly on shell->envp—updates related function signatures, and removes leftover debug statements and test targets.

  • Drop explicit env parameters from interactive loops and process_input
  • Deep-copy and properly free environment arrays in setter/unsetter functions
  • Remove inline debug prints in pipeline code and eliminate Makefile test targets

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main.c Updated interactive loop and input handler to use shell->envp only
src/init.c Changed process_input signature and its calls
src/executor/pipeline_utils.c Removed debug printf for pipe creation
src/executor/pipeline.c Removed debug printf for pipeline execution
src/environment/env_utils.c Added get_env_index helper
src/environment/env_set.c Deep‐copy environment entries and safely free old arrays
src/environment/env_modifiers.c Refactored add/remove env var to duplicate entries
src/environment/env_manager.c Introduced create_env_without_var and cleaned up old env
src/environment/env_expansion.c Stripped debug message on expansion failure
includes/minishell.h Updated process_input prototype
Makefile Removed test and test-valgrind targets
Comments suppressed due to low confidence (5)

src/main.c:46

  • Remove the outdated @param env line from the doc comment above handle_input_line since the env parameter was removed.
 * @param env Environment variables

src/main.c:62

  • Remove the outdated @param env line from the doc comment above run_interactive_loop to match its updated signature.
 * @param env Environment variables

src/init.c:75

  • Update the doc comment for process_input: remove the @param env entry since the function no longer takes an env argument.
 * @param env Environment variables.

Makefile:179

  • Since the test and test-valgrind targets were removed, update the surrounding comments or README to reflect that tests are now run differently or no longer bundled.
valgrind: $(NAME)

src/environment/env_manager.c:61

  • [nitpick] Consider refactoring create_env_without_var to only accept env and skip_index, and initialize i and j internally for clearer intent.
static char	**create_env_without_var(char **env, int skip_index, int i, int j)

@NaBuchholz NaBuchholz merged commit 4d6d1da into main Jul 13, 2025
2 checks passed
@NaBuchholz NaBuchholz deleted the dev branch July 13, 2025 21:45
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

Successfully merging this pull request may close these issues.

2 participants