Update environment variable handling and clean up debug statements#85
Merged
NaBuchholz merged 6 commits intomainfrom Jul 13, 2025
Merged
Update environment variable handling and clean up debug statements#85NaBuchholz merged 6 commits intomainfrom
NaBuchholz merged 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
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
envparameters from interactive loops andprocess_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 envline from the doc comment abovehandle_input_linesince theenvparameter was removed.
* @param env Environment variables
src/main.c:62
- Remove the outdated
@param envline from the doc comment aboverun_interactive_loopto match its updated signature.
* @param env Environment variables
src/init.c:75
- Update the doc comment for
process_input: remove the@param enventry since the function no longer takes anenvargument.
* @param env Environment variables.
Makefile:179
- Since the
testandtest-valgrindtargets 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_varto only acceptenvandskip_index, and initializeiandjinternally for clearer intent.
static char **create_env_without_var(char **env, int skip_index, int i, int j)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor the code to improve environment variable handling and remove unnecessary debug print statements. Update the Makefile to eliminate test targets.