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

Add genodsp #51488

Merged
merged 13 commits into from
Oct 22, 2024
11 changes: 11 additions & 0 deletions recipes/genodsp/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -e
set -uex

mkdir -vp "${PREFIX}/bin"

make VERBOSE=1 -j ${CPU_COUNT}

if ! install -v "$SRC_DIR/genodsp" "$PREFIX/bin/genodsp"; then
echo "Failed to install genodsp binary" >&2
exit 1
fi
36 changes: 36 additions & 0 deletions recipes/genodsp/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{% set name = "genodsp" %}
{% set version = "0.0.3" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/rsharris/genodsp/archive/refs/tags/v{{ version }}+.zip
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove the '+' from the source URL.

The '+' in the URL might cause issues when fetching the source. Consider removing it:

url: https://github.com/rsharris/genodsp/archive/refs/tags/v{{ version }}.zip

sha256: a7fb2218311d1ae5231041863d28adb8b5fffe724fc5ff2422310ce90a9f894a
patches:
- stringop-truncation.patch

requirements:
build:
- {{ compiler('c') }}
- make
richard-burhans marked this conversation as resolved.
Show resolved Hide resolved

build:
number: 0
skip: True # [not linux or not x86_64]
run_exports:
- {{ pin_subpackage('genodsp', max_pin="x.x") }}

test:
commands:
- genodsp --help
- ls -l ${PREFIX}/bin/
- ${PREFIX}/bin/genodsp --help

about:
home: https://github.com/rsharris/genodsp
summary: General workbench for processing signals along genomic (chromosomal) intervals
license: GPL-3.0-only
license_file: LICENSE
license_url: https://github.com/rsharris/genodsp/blob/master/LICENSE
182 changes: 182 additions & 0 deletions recipes/genodsp/stringop-truncation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
diff --git a/Makefile b/Makefile
index cf07368..d1dfb95 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,4 @@
CFLAGS = -O3 -Wall -Wextra -Werror
-CC = gcc
LDLIBS = -lm

operators = sum clump percentile add multiply mask logical minmax morphology map opio variables
diff --git a/add.c b/add.c
index 752dd5d..8fa4bad 100644
--- a/add.c
+++ b/add.c
@@ -240,7 +240,7 @@ void op_add_apply
v = NULL;
chromSpec = find_chromosome_spec (chrom);
if (chromSpec != NULL) v = chromSpec->valVector;
- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

if (chromSpec == NULL) continue;
@@ -533,7 +533,7 @@ void op_subtract_apply
v = NULL;
chromSpec = find_chromosome_spec (chrom);
if (chromSpec != NULL) v = chromSpec->valVector;
- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

if (chromSpec == NULL) continue;
diff --git a/genodsp.c b/genodsp.c
index ac1704e..dffd622 100644
--- a/genodsp.c
+++ b/genodsp.c
@@ -1229,7 +1229,7 @@ void read_intervals
v = NULL;
chromSpec = find_chromosome_spec (chrom);
if (chromSpec != NULL) v = chromSpec->valVector;
- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

if (chromSpec == NULL) continue;
diff --git a/logical.c b/logical.c
index fb295e3..45e1c20 100644
--- a/logical.c
+++ b/logical.c
@@ -497,7 +497,7 @@ void op_or_apply
v = NULL;
chromSpec = find_chromosome_spec (chrom);
if (chromSpec != NULL) v = chromSpec->valVector;
- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

if (chromSpec == NULL) continue;
@@ -810,7 +810,7 @@ void op_and_apply
if (chromSpec->flag) goto chrom_not_together;
}

- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

// if the current chromosome is not of any interest, ignore this
diff --git a/mask.c b/mask.c
index 4fd5ebd..ddd068e 100644
--- a/mask.c
+++ b/mask.c
@@ -253,7 +253,7 @@ void op_mask_apply
v = NULL;
chromSpec = find_chromosome_spec (chrom);
if (chromSpec != NULL) v = chromSpec->valVector;
- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

if (chromSpec == NULL) continue;
@@ -548,7 +548,7 @@ void op_mask_not_apply
if (chromSpec->flag) goto chrom_not_together;
}

- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

// if the current chromosome is not of any interest, ignore this
diff --git a/minmax.c b/minmax.c
index c222bd0..eae69ab 100644
--- a/minmax.c
+++ b/minmax.c
@@ -261,7 +261,7 @@ void op_min_in_interval_apply
if (chromSpec->flag) goto chrom_not_together;
}

- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

// if the current chromosome is not of any interest, ignore this
@@ -664,7 +664,7 @@ void op_max_in_interval_apply
if (chromSpec->flag) goto chrom_not_together;
}

- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

// if the current chromosome is not of any interest, ignore this
@@ -1941,7 +1941,7 @@ void op_min_with_apply
v = NULL;
chromSpec = find_chromosome_spec (chrom);
if (chromSpec != NULL) v = chromSpec->valVector;
- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

if (chromSpec == NULL) continue;
@@ -2227,7 +2227,7 @@ void op_max_with_apply
v = NULL;
chromSpec = find_chromosome_spec (chrom);
if (chromSpec != NULL) v = chromSpec->valVector;
- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

if (chromSpec == NULL) continue;
diff --git a/multiply.c b/multiply.c
index 4c1b550..d04cc41 100644
--- a/multiply.c
+++ b/multiply.c
@@ -260,7 +260,7 @@ void op_multiply_apply
if (chromSpec->flag) goto chrom_not_together;
}

- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

// if the current chromosome is not of any interest, ignore this
@@ -654,7 +654,7 @@ void op_divide_apply
if (chromSpec->flag) goto chrom_not_together;
}

- strncpy (prevChrom, chrom, sizeof(prevChrom));
+ safe_strncpy (prevChrom, chrom, sizeof(prevChrom));
}

// if the current chromosome is not of any interest, ignore this
diff --git a/utilities.c b/utilities.c
index 03d2ff1..64e85e6 100644
--- a/utilities.c
+++ b/utilities.c
@@ -493,3 +493,13 @@ char* ucommatize
return s;
}

+//
+void safe_strncpy
+ (char *dest, const char *src, size_t n)
+ {
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wstringop-truncation"
+ strncpy(dest, src, n);
+ #pragma GCC diagnostic pop
+ dest[n-1] = '\0'; // Ensure null-termination
+ }
richard-burhans marked this conversation as resolved.
Show resolved Hide resolved
diff --git a/utilities.h b/utilities.h
index ac9cef7..87cfc2d 100644
--- a/utilities.h
+++ b/utilities.h
@@ -31,6 +31,8 @@ char* skip_whitespace (char* s);
char* skip_darkspace (char* s);
char* duration_to_string (float seconds);
char* ucommatize (const u32 v);
+void safe_strncpy (char *dest, const char *src, size_t n);
+

// miscellany

Loading