-
Notifications
You must be signed in to change notification settings - Fork 22
Various small fixes and reverse dependency tests using packit #166
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
Changes from all commits
140637f
428ba93
75b5fef
3afeab4
5d2d1cf
41aa5f9
3fd6023
26631d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| language: "en-US" | ||
| early_access: false | ||
| reviews: | ||
| profile: "chill" | ||
| poem: false | ||
| in_progress_fortune: false | ||
| sequence_diagrams: false | ||
| related_issues: false | ||
| related_prs: false | ||
| suggested_labels: false | ||
| suggested_reviewers: false | ||
| path_filters: ["!po/**", "!plans/**", "!.github/**", "!.fmf/**"] | ||
| chat: | ||
| art: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # reverse dependency test for blivet | ||
| enabled: false | ||
|
|
||
| adjust+: | ||
| when: revdeps_blivet == yes | ||
| enabled: true | ||
|
|
||
| prepare: | ||
| - name: copr | ||
| how: shell | ||
| script: | ||
| - sudo dnf install -y python3-libdnf5 'dnf-command(copr)' | ||
| - sudo dnf copr enable -y @storage/udisks-daily | ||
| # TF prioritizes Fedora tag repo over all others, in particular our daily COPR | ||
| - for f in $(grep -l -r 'testing-farm-tag-repository' /etc/yum.repos.d); do sed -i '/priority/d' "$f" ;done | ||
| - sudo dnf -y update | ||
|
|
||
| - name: ansible | ||
| how: shell | ||
| script: | ||
| - sudo dnf install -y curl ansible | ||
| - curl -Ok https://raw.githubusercontent.com/storaged-project/blivet/main/misc/install-test-dependencies.yml | ||
| - curl -Ok https://raw.githubusercontent.com/storaged-project/blivet/main/misc/blivet-tasks.yml | ||
| - ansible-playbook -K -i "localhost," -c local install-test-dependencies.yml | ||
|
|
||
| discover: | ||
| how: shell | ||
| url: https://github.com/storaged-project/blivet | ||
| ref: main | ||
| tests: | ||
| - name: all | ||
| test: make test | ||
|
|
||
| execute: | ||
| how: tmt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| summary: Run tests | ||
|
|
||
| adjust+: | ||
| - when: revdeps_blivet == yes | ||
| enabled: false | ||
|
|
||
| prepare: | ||
| - name: ansible | ||
| how: ansible | ||
| playbook: misc/install-test-dependencies.yml | ||
|
|
||
| execute: | ||
| how: tmt | ||
| script: ./autogen.sh && ./configure && make -j && make ci |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| #include <string.h> | ||
| #include <ctype.h> | ||
| #include <limits.h> | ||
| #include <assert.h> | ||
|
|
||
| /* set code unit width to 8 so we can use generic macros like 'pcre2_compile' | ||
| * instead of 'pcre2_compile_8' | ||
|
|
@@ -398,6 +399,7 @@ void bs_clear_error (BSError **error) { | |
| */ | ||
| BSSize bs_size_new (void) { | ||
| BSSize ret = (BSSize) malloc (sizeof(struct _BSSize)); | ||
| assert (ret); | ||
| bs_size_init (ret); | ||
| return ret; | ||
| } | ||
|
Comment on lines
400
to
405
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, verify the code at the specified location
cat -n src/bs_size.c | sed -n '395,410p'Repository: storaged-project/libbytesize Length of output: 578 🏁 Script executed: # Check for NDEBUG definition in build configuration
rg -n "NDEBUG" -g '*.am' -g '*.ac' -g 'configure*' -g 'Makefile*' -g 'meson.build' --max-count 20Repository: storaged-project/libbytesize Length of output: 54 🏁 Script executed: # Check CFLAGS in configure.ac if it exists
if [ -f configure.ac ]; then
rg -n "CFLAGS" configure.ac
fiRepository: storaged-project/libbytesize Length of output: 156 🏁 Script executed: # Look for similar malloc patterns in the codebase to understand project conventions
rg -n "malloc.*assert" -A 2 -B 1 --type c | head -40Repository: storaged-project/libbytesize Length of output: 54 🏁 Script executed: # Look for other error handling patterns in the same file
rg -n "abort\(\)|exit\(\)|malloc.*if|malloc.*NULL" src/bs_size.c -B 2 -A 2Repository: storaged-project/libbytesize Length of output: 54 🏁 Script executed: # Check how other similar constructor/new functions handle allocation
ast-grep --pattern 'BSSize $_ (void) {
$$$
malloc($$$)
$$$
}' src/bs_size.cRepository: storaged-project/libbytesize Length of output: 54 🏁 Script executed: # Look at other files in the codebase for common error handling patterns
rg -n "malloc.*assert|malloc.*if.*NULL|malloc.*abort" --type c | head -20Repository: storaged-project/libbytesize Length of output: 54 🏁 Script executed: # Check if there's a CONTRIBUTING or design doc that explains error strategy
fd -type f \( -name "CONTRIBUTING*" -o -name "DESIGN*" -o -name "README*" -o -name "*.md" \) | head -10Repository: storaged-project/libbytesize Length of output: 242 🏁 Script executed: # Search for all malloc usage in bs_size.c to understand pattern consistency
rg -n "malloc" src/bs_size.c -B 1 -A 2Repository: storaged-project/libbytesize Length of output: 695 🏁 Script executed: # Check for documentation files
fd -type f \( -name "*.md" -o -name "README*" -o -name "DESIGN*" \)Repository: storaged-project/libbytesize Length of output: 242 🏁 Script executed: # Look at the full file to understand library style and conventions
wc -l src/bs_size.cRepository: storaged-project/libbytesize Length of output: 90 🏁 Script executed: # Check for glib dependencies (hint: libbytesize is a GLib-based library)
rg -n "g_malloc|g_error|GError" src/bs_size.c | head -10Repository: storaged-project/libbytesize Length of output: 54 🏁 Script executed: # Check what other "new" functions do
rg -n "(\w+)_new.*\{" src/bs_size.c -A 5 | head -50Repository: storaged-project/libbytesize Length of output: 1176 🏁 Script executed: # Check how bs_size_new() is called from other functions - does it handle errors?
rg -n "bs_size_new\(" src/bs_size.c -B 1 -A 3Repository: storaged-project/libbytesize Length of output: 54 🏁 Script executed: # Try different pattern - look for calls to bs_size_new
rg -n "bs_size_new" src/bs_size.c -B 1 -A 3Repository: storaged-project/libbytesize Length of output: 3352 🏁 Script executed: # Also check if there are any other files that call bs_size_new
rg -n "bs_size_new" --type c --type hRepository: storaged-project/libbytesize Length of output: 1418 Replace assert-based null check with explicit error handling that remains active in release builds. The 🛠️ Suggested alternative BSSize bs_size_new (void) {
BSSize ret = (BSSize) malloc (sizeof(struct _BSSize));
- assert (ret);
+ if (!ret) {
+ abort();
+ }
bs_size_init (ret);
return ret;
}🤖 Prompt for AI Agents |
||
|
|
@@ -701,6 +703,7 @@ uint64_t bs_size_get_bytes (const BSSize size, int *sgn, BSError **error) { | |
| mpz_set_str (max, num_str, 10); | ||
| free (num_str); | ||
| if (mpz_cmp (size->bytes, max) > 0) { | ||
| mpz_clear (max); | ||
| set_error (error, BS_ERROR_OVER, strdup("The size is too big, cannot be returned as a 64bit number of bytes")); | ||
| return 0; | ||
| } | ||
|
|
@@ -1212,7 +1215,7 @@ char* bs_size_true_div (const BSSize size1, const BSSize size2, BSError **error) | |
|
|
||
| if (mpz_cmp_ui (size2->bytes, 0) == 0) { | ||
| set_error (error, BS_ERROR_ZERO_DIV, strdup_printf("Division by zero")); | ||
| return 0; | ||
| return NULL; | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| mpf_init2 (op1, BS_FLOAT_PREC_BITS); | ||
|
|
@@ -1248,7 +1251,7 @@ char* bs_size_true_div_int (const BSSize size, uint64_t divisor, BSError **error | |
|
|
||
| if (divisor == 0) { | ||
| set_error (error, BS_ERROR_ZERO_DIV, strdup_printf ("Division by zero")); | ||
| return 0; | ||
| return NULL; | ||
| } else if (divisor > ULONG_MAX) { | ||
| set_error (error, BS_ERROR_OVER, strdup_printf ("Divisor too big, must be less or equal to %lu", ULONG_MAX)); | ||
| return NULL; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.