Compare commits

..

No commits in common. "bcd77d9ed6d5308799d25a69e87be189252580b7" and "d76ed2585dbbbe739a40e486994ea5b8cc4d6b1f" have entirely different histories.

8 changed files with 8 additions and 70 deletions

View file

@ -1,10 +0,0 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: build
image: rust:latest
commands:
- cargo test

1
.gitignore vendored
View file

@ -2,7 +2,6 @@
/imgs
fif_*
/old
/.mypy_cache
*.sh
!clippy.sh
cargo-timing*.html

View file

@ -10,13 +10,6 @@
</Attribute>
</value>
</entry>
<entry key="/src/mimedb.rs">
<value>
<Attribute>
<option name="separator" value="&#9;" />
</Attribute>
</value>
</entry>
<entry key="/src/parameters.rs">
<value>
<Attribute>

View file

@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python facet">
<configuration sdkName="Python 3.9" />
</facet>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
@ -12,10 +7,8 @@
<excludeFolder url="file://$MODULE_DIR$/imgs" />
<excludeFolder url="file://$MODULE_DIR$/old" />
<excludeFolder url="file://$MODULE_DIR$/awful" />
<excludeFolder url="file://$MODULE_DIR$/.mypy_cache" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Python 3.9 interpreter library" level="application" />
</component>
</module>

View file

@ -5,12 +5,12 @@ version = "0.2.6"
authors = ["Lynnesbian <lynne@bune.city>"]
edition = "2018"
license = "GPL-3.0-or-later"
rust-version = "1.43.0" # cached breaks on 1.42.0, i think it needs https://github.com/rust-lang/rust/pull/67642/
rust-version = "1.43.0" # cached requires 1.42.0
repository = "https://git.bune.city/lynnesbian/fif"
readme = "README.md"
keywords = ["mime", "mimetype", "utilities", "tools"]
categories = ["command-line-utilities"]
exclude = [".idea/", "Cross.toml", "*.sh", "*.py", ".drone.yml"]
exclude = [".idea/", "Cross.toml", "*.sh"]
#resolver = "2"
#license-file = "LICENSE"

View file

@ -32,7 +32,6 @@ use crate::mimedb::MimeDb;
use crate::parameters::OutputFormat;
use crate::scanerror::ScanError;
use std::process::exit;
use env_logger::Env;
mod extensionset;
mod findings;
@ -216,10 +215,7 @@ fn init_db() {
fn main() {
let args = parameters::Parameters::parse();
let mut builder = env_logger::Builder::from_env(
Env::new().filter_or("RUST_LOG", "WARN")
);
let mut builder = env_logger::Builder::from_default_env();
builder
// .format(|buf, r| writeln!(buf, "{} - {}", r.level(), r.args()))
.format_module_path(false) // don't include module in logs, as it's not necessary

View file

@ -25,6 +25,11 @@ cfg_if! {
fn init() -> Self {
let mut info = infer::Infer::new();
// jpeg2000 support because why the stinch not
info.add("image/jpeg2000", ".jp2", |buf| {
buf.len() > 23 && buf[..23] == b"\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A\x6A\x70\x32\x20"[..]
});
info.add("application/vnd.oasis.opendocument.text", "odt", |buf| {
open_document_check(buf, "text")
});

38
test.py
View file

@ -1,38 +0,0 @@
#!/usr/bin/env python
import re
import subprocess
def main():
match = re.search(
r'rust-version ?= ?"([\d.]+)"',
open("Cargo.toml", "r").read(-1)
)
if not match:
print("Couldn't find rust-version")
exit(1)
versions = [match.group(1), "stable", "beta", "nightly"]
backends = ["xdg-mime", "infer"]
done = 0
target = len(versions) * len(backends) * 2
for version in versions:
for backend in backends:
print(f"[{version}, {backend}] Tests")
subprocess.run(f"cargo +{version} test --features={backend}-backend".split(" "))
done += 1
print(f"Success - {done} of {target} complete")
print(f"[{version}, {backend}] Scanning imgs")
subprocess.run(f"cargo +{version} run --release --features={backend}-backend -- -E images imgs".split(" "))
done += 1
print(f"Success - {done} of {target} complete")
print("Done! You might want to run cargo clean...")
if __name__ == "__main__":
main()