profile
viewpoint

CloCkWeRX/rabbitvcs-svn-mirror 12

The new home of rabbitvcs

detly/arkfind 12

A utility to recursively search for files by name in a filesystem, also looking inside archives to an arbitary depth.

detly/audiolab 5

A python package for reading/writing audio files from numpy array

detly/detan 5

Deterministic annealing Python library

detly/base16-classic-scheme 1

Older version of the default Base16 schemes.

detly/boron-komodo 1

A port of the Sublime Text Boron theme for Komodo Edit

detly/dart 1

Hybrid Kali/Wheezy live build

detly/asyncnethack 0

A pseudo-terminal that wraps everyone's favorite dungeon game

detly/base16-builder 0

Base16 Builder

detly/base16-mintty 0

Base16 for MinTTY

issue commentrust-lang/rustfmt

Gives up on chains if any line is too long.

Minor suggestion: would relating the scale "factor" to the indentation used be a sensible thing (or just making it the indentation)? (Factor is in quotes because it would change it into an additive process, not a multiplicative one.)

Clarification: would the "scaled retry attempts" reapply the chain scale factor as a multiplier (eg. 100, 120, 144, 172) or add the same 20% of the original max_width (100, 120, 140, 160)?

ehuss

comment created time in 3 days

push eventdetly/mactel-boot

James Sanderson

commit sha a972da90b8d561f7b9ed52584aac688c99dabf9a

Include unistd.h for 'close'

view details

Jason Heeris

commit sha f60aae1c083d0e6ddc2f93977725b20cdb431798

Merge pull request #1 from zofrex/include-close Include unistd.h for 'close'

view details

push time in a month

PR merged detly/mactel-boot

Include unistd.h for 'close'

Fixes warnings about implicit declaration of close.

Clang:

bless.c:62:2: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
        close(fd);
        ^
1 warning generated.

GCC:

bless.c: In function ‘main’:
bless.c:62:2: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
  close(fd);
  ^~~~~
  pclose
+1 -0

1 comment

1 changed file

zofrex

pr closed time in a month

issue commentnextcloud/server

Cannot move large numbers of files to external (Backblaze B2) storage

I have discovered rclone which can do remote-to-remote copy via WebDAV. It's a brilliant tool for this.

detly

comment created time in a month

issue openednextcloud/server

Cannot move large numbers of files to external (Backblaze B2) storage

<!--- Please keep this note for other contributors -->

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Add Backblaze B2 instance as external storage via the admin settings using these instructions.
  2. In the web UI, select a directory containing about 16GB worth of files ie. a few thousand photos, in the year/month structure used by the Android uploader.
  3. Select “Move or copy” from the actions menu.
  4. Select a folder under the new Backblaze storage.

Expected behaviour

  • The files are eventually moved without any intervention from me.
  • If there is a failure:
    • I am told or can find out what state my files are in.
    • I can attempt the operation again, or resume it, or repeat the move but merge the trees.
    • The log lets me diagnose the problem.

Actual behaviour

  • I see a spinner over the folder and a partially obscured progress bar appear at the top of the directory pane.
  • Nothing changes for over an hour.
  • Eventually I get an error saying the files could not be moved
  • If I look in the Backblaze storage, I can see that some of the files were moved, but not all.
  • I try to move the same origin folder to the same destination again, Nextcloud refuses because it already exists.

There is no practical way to copy these files. I cannot copy them one by one, there are thousands. I cannot merge the directory trees, Nextcloud does not provide that feature. I cannot do this on desktop, there is too much data to download and sync.

Nothing I can find in the docs tells me what state my files might be in after the failure. Partly moved? Duplicated but not yet deleted from the source? Can I delete the destination files without losing data? It looks like it's copied first, and not deleted from the origin until the entire tree is correctly copied, but I can't confirm that.

Server configuration

Operating system: Linux based. It's shared hosting, so I'm not sure beyond that.

Web server: Also not sure.

Database: MySQL

PHP version: 7.4

Nextcloud version: 22.2.0

Updated from an older Nextcloud/ownCloud or fresh install: Updated from NC 10 via every major version in between.

Where did you install Nextcloud from: Command line using zip installer from website (for 10), then upgrader for each version since.

Signing status: <details> <summary>Signing status</summary>

No errors have been found.

</details>

List of activated apps: <details> <summary>App list</summary>

Enabled:
  - accessibility: 1.8.0
  - activity: 2.15.0
  - bruteforcesettings: 2.2.0
  - checksum: 1.1.2
  - cloud_federation_api: 1.5.0
  - comments: 1.12.0
  - dav: 1.19.0
  - federatedfilesharing: 1.12.0
  - files: 1.17.0
  - files_external: 1.13.0
  - files_markdown: 2.3.4
  - files_pdfviewer: 2.3.0
  - files_rightclick: 1.1.0
  - files_sharing: 1.14.0
  - files_trashbin: 1.12.0
  - files_versions: 1.15.0
  - files_videoplayer: 1.11.0
  - firstrunwizard: 2.11.0
  - groupfolders: 10.0.0
  - logreader: 2.7.0
  - lookup_server_connector: 1.10.0
  - nextcloud_announcements: 1.11.0
  - notes: 4.1.1
  - notifications: 2.10.1
  - oauth2: 1.10.0
  - password_policy: 1.12.0
  - photos: 1.4.0
  - privacy: 1.6.0
  - privatedata: 2.0.0
  - provisioning_api: 1.12.0
  - settings: 1.4.0
  - support: 1.5.0
  - survey_client: 1.10.0
  - systemtags: 1.12.0
  - text: 3.3.0
  - theming: 1.13.0
  - twofactor_backupcodes: 1.11.0
  - updatenotification: 1.12.0
  - viewer: 1.6.0
  - workflowengine: 2.4.0
Disabled:
  - admin_audit
  - circles
  - contactsinteraction
  - dashboard
  - encryption
  - federation
  - previewgenerator
  - recommendations
  - serverinfo
  - sharebymail
  - user_ldap
  - user_status
  - weather_status

</details>

Nextcloud configuration: <details> <summary>Config report</summary>

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REDACTED***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/***REDACTED***",
        "dbtype": "mysql",
        "version": "22.2.0.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "AU",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_smtpport": "465",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "theme": "",
        "loglevel": 0,
        "maintenance": false,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "trashbin_retention_obligation": "auto,60",
        "activity_expire_days": 90,
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mysql.utf8mb4": true,
        "app_install_overwrite": [
            "privatedata"
        ],
        "mail_sendmailmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "enable_previews": false
    }
}

</details>

Are you using external storage, if yes which one: Unsure, shared hosting.

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox 93.0

Operating system: Ubuntu 21.04

Logs

<!--- Reports without logs might be closed as unqualified reports! -->

I cannot get useful logs for this from Nextcloud. Unfortunately the files_sharing app spams it with deprecation notices several times a second so it’s quite a challenge.

Web server error log - I don't think I have that enabled. I will update the issue with it if I can.

Because this takes over an hour to fully reproduce, it's a bit hard to collect other logs. I will update this issue with any interesting contents of data/nextcloud.log and the browser log when I can.

Nextcloud log (data/nextcloud.log)

<details> <summary>Nextcloud log</summary>

Insert your Nextcloud log here

</details>

created time in a month

issue openedrust-lang/rust

2021 edition's binding to sub-pattern doesn't work on enum with copyable fields

I tried the new "binding to sub-patterns" feature in the 2021 edition and it did not work as I expected, or consistently. Here's a playground link.

First, I tried:

// NOT copy!
#[derive(Debug)]
enum One {
    A,
    B(bool),
}

fn main() {
    let a = One::B(true);
    
    match a {
        One::A => println!("A"),
        other @ One::B(success) => {
            println!("{:?}", other);
            println!("{}", success);
        }
    }
}

I expected that even though the wrapping enum is not Copy, because the nested bool value is, it would be copied into success. However, I get the error:

error[E0382]: use of moved value: `a`
  --> src/main.rs:13:24
   |
9  |     let a = One::B(true);
   |         - move occurs because `a` has type `One`, which does not implement the `Copy` trait
...
13 |         other @ One::B(success) => {
   |         ---------------^^^^^^^-
   |         |              |
   |         |              value used here after move
   |         value moved here

For more information about this error, try `rustc --explain E0382`.
error: could not compile `playground` due to previous error

Comparing this to the example in the release notes, where there's a non-Copy container (Matrix) with a Copy-able field (row_len), I don't see why it shouldn't work the same way.

Strangely (I think), if I remove the A variant, it works. So infallible patterns allow this.

It will also work if I do ref other @ One::B(success), but then I can't take ownership of other.

Rust version: rustc 1.56.0 (09c42c458 2021-10-18)
Platform: Ubuntu 21.04
Installed via Rustup

created time in a month

PR opened Wheatwizard/Lost

Clarified wrapping behaviour in README

I read the interpreter and figured it out. Fixes #1.

+1 -1

0 comment

1 changed file

pr created time in a month

push eventdetly/Lost

Jason Heeris

commit sha d630ec7ff9521747f6392cc446add291996f4cef

Clarified wrapping behaviour in README

view details

push time in a month

fork detly/Lost

Lost is a 2 dimensional language in which the start location and direction are entirely random

fork in a month

issue openedWheatwizard/Lost

Readme doesn't say what happens when the IP reaches the edge

For example, in the hello world program, what happens if the IP starts in the top row, near the right edge, moving right?

created time in a month

push eventdetly/rustydav

Jason Heeris

commit sha b8f320dad10cb692e65d72b61599a2361e8849e7

Added overwrite flag to mv function.

view details

Jason Heeris

commit sha 30c73800378132a958bb113e86c67129b6cefdbb

Simplified test asserts.

view details

push time in 2 months

fork detly/rustydav

Implementation of webdav requests in rust

fork in 2 months

issue commentdtolnay/thiserror

Can thiserror be converted into from arbitrary errors?

@nu11ptr Someone on the user forum pointed out that anyhow actually doesn't implement Error to get around this.

The thing I can't understand is that there's a blanket impl for converting Errors in core: std::convert::From<Error> for type Error. So why can't I use it to convert errors?

detly

comment created time in 2 months

Pull request review commentJelteF/derive_more

Add documentation for DebugCustom derive

 use std::path::PathBuf; #[derive(Display)] struct MyInt(i32); +#[derive(DebugCustom)]+#[debug(fmt = "MyIntDbg(as hex: {:x}, as dec: {})", _0, _0)]+struct MyIntDbg(i32);++#[derive(Display)]+#[display(fmt = "({}, {})", x, y)]+struct Point2D {+    x: i32,+    y: i32,+}+

Forgot to click the button for a week and a half :upside_down_face:

detly

comment created time in 2 months

PullRequestReviewEvent

create barnchdetly/calloop

branch : slotmap-tweaks

created branch time in 2 months

issue commentdtolnay/thiserror

Can thiserror be converted into from arbitrary errors?

Otherwise, I guess you could create a macro to contain the repeated code?

The repeated code is mostly just .map_err(Into::into), I'm not sure I could make a macro more concise than that. It's really just not needing a caller to have to worry about adding things before ? at all, but it sounds like that's not possible.

Does implementing From<dyn ...> or similar work?

Isn't that what:

#[error("error generated by event source or callback")]
CallbackError(#[from] Box<dyn std::error::Error + Sync + Send>)

...does? Or am I mistaken?

detly

comment created time in 2 months

Pull request review commentJelteF/derive_more

Add documentation for DebugCustom derive

 use std::path::PathBuf; #[derive(Display)] struct MyInt(i32); +#[derive(DebugCustom)]+#[debug(fmt = "MyIntDbg(as hex: {:x}, as dec: {})", _0, _0)]+struct MyIntDbg(i32);++#[derive(Display)]+#[display(fmt = "({}, {})", x, y)]+struct Point2D {+    x: i32,+    y: i32,+}+

Ooops.

detly

comment created time in 2 months

PullRequestReviewEvent

push eventdetly/derive_more

Jason Heeris

commit sha 37442ebc7bd91f59d0a471e3382f79b3eea9d8d9

Added note about DebugCustom to display-like trait docs.

view details

push time in 2 months

push eventdetly/calloop

push time in 2 months

PR closed Smithay/calloop

Custom error type for Calloop

This is a final-ish draft of creating an error type for Calloop that covers all the major use cases (internal and external). The two things holding it back from not being a draft are:

  • I don't yet know how to exclude necessary parts from tarpaulin
  • I'd like to use it with a couple of my work projects, but I need to port various parts for Calloop's recent changes

Sorry it took so long, it was hard to accommodate certain niche cases. I think I've made it as ergonomic as possible.

The basic gist is:

  • There's a main error type calloop::errors::Error which can take conversions from std::io::Error and anything that converts into Box<dyn Error + Sync + Send>.
  • There's a separate error for InsertError, because it's a bit special but rare.
  • User callbacks or event source code should just be able to use ? and not worry about mapping to and from IO errors etc.

I've used thiserror where possible to remove some boilerplate, it's worked quite nicely but is the source of the tarpaulin issue.

+236 -172

4 comments

16 changed files

detly

pr closed time in 2 months

pull request commentSmithay/calloop

Custom error type for Calloop

Closing this PR while I redo some of it.

detly

comment created time in 2 months

create barnchdetly/calloop

branch : custom-error-type

created branch time in 2 months

issue openeddtolnay/thiserror

Can thiserror be converted into from arbitrary errors?

I'm trying to create some structured error types for Calloop. The tricky thing here is that it's an event loop, so it not only has to pass out sensible errors, but handle errors from user code in callbacks and trait implementations (which may also then get passed out as well).

I started off with something like this:

#[derive(thiserror::Error, Debug)]
enum Error {
    #[error("invalid token provided to internal function")]
    InvalidToken,

    #[error("underlying IO error")]
    IoError(#[from] std::io::Error),

    #[error("error generated by event source or callback")]
    CallbackError(#[from] Box<dyn std::error::Error + Sync + Send>),
}

type Result<T> = core::result::Result<T, Error>;

The actual API looks like this:

fn process_events<F>(
    &mut self,
    readiness: Readiness,
    token: Token,
    callback: F
) -> Result<PostAction> where
    F: FnMut(Self::Event, &mut Self::Metadata) -> Self::Ret, 

It is intended that users create their own implementations of this by composing lower level event sources, connecting these implementations together with callbacks if necessary. If those implementations use the error kinds of lower level systems (eg. std::io, 3rd party crates), then it very quickly becomes a burden to shoehorn all the different results into one return type (said from experience!).

(The callbacks, F, are called from process_events() but they're a bit of a red herring. They're not the hard part, because users can just make the associated type Ret be Result<_, calloop::Error> or whatever.)

Leaving aside Calloop's API for a moment, here's some minimal examples of what I mean (note the Result type is the alias above, not core::Result):

fn test_function_1() -> Result<String> {
    let v = &[0xDD1E, 0x006d];
    Ok(String::from_utf16(v)?)
}

fn test_function_2() -> Result<()> {
    Err(anyhow::anyhow!("oh no"))?;
    Ok(())
}

These are just examples. They could be any kind of errors, but they demonstrate my difficulty in accommodating arbitrary errors via thiserror. Unfortunately this fails to compile:

   Compiling playground v0.0.1 (/playground)
error[E0277]: `?` couldn't convert the error to `Error`
  --> src/lib.rs:17:29
   |
15 | fn test_function_1() -> Result<String> {
   |                         -------------- expected `Error` because of this
16 |     let v = &[0xDD1E, 0x006d];
17 |     Ok(String::from_utf16(v)?)
   |                             ^ the trait `From<FromUtf16Error>` is not implemented for `Error`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
   = help: the following implementations were found:
             <Error as From<Box<(dyn std::error::Error + Send + Sync + 'static)>>>
             <Error as From<std::io::Error>>
   = note: required because of the requirements on the impl of `FromResidual<std::result::Result<Infallible, FromUtf16Error>>` for `std::result::Result<String, Error>`
   = note: required by `from_residual`

error[E0277]: `?` couldn't convert the error to `Error`
  --> src/lib.rs:21:34
   |
20 | fn test_function_2() -> Result<()> {
   |                         ---------- expected `Error` because of this
21 |     Err(anyhow::anyhow!("oh no"))?;
   |                                  ^ the trait `From<anyhow::Error>` is not implemented for `Error`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion   on the error value using the `From` trait
   = help: the following implementations were found:
             <Error as From<Box<(dyn std::error::Error + Send + Sync + 'static)>>>
             <Error as From<std::io::Error>>
   = note: required because of the requirements on the impl of `FromResidual<std::result::Result<Infallible, anyhow::Error>>` for `std::result::Result<(), Error>`
   = note: required by `from_residual`

However, it does compile if I add map_err() eg.

Ok(String::from_utf16(v).map_err(|e| Error::CallbackError(e.into()))?)

But this is exactly the kind of thing I'm trying to make more ergonomic by implementing a proper error type! If users are going to have to sprinkle map_err() everywhere, there's no gain from codifying error types. The really annoying thing is, it's all identical boilerplate, which seems like it should be covered by some kind of conversion. The exact same snippet, map_err(|e| Error::CallbackError(e.into())), works on FromUtf16Error, anyhow::Error, etc. etc. All it does is call into()!

I had thought that I could implement a trait to do this for me eg.

impl<E: std::error::Error> From<E> for Error {
    fn from(error: E) -> Self {
        Self::CallbackError(error.into())
    }
}

Nope!

   Compiling playground v0.0.1 (/playground)
error[E0119]: conflicting implementations of trait `std::convert::From<Error>` for type `Error`
  --> src/lib.rs:13:1
   |
13 | impl<E: std::error::Error> From<E> for Error {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: conflicting implementation in crate `core`:
           - impl<T> From<T> for T;

(As an aside, this is extremely baffling to me — I can't implement a conversion from the trait my error type implements to my own error type... because there's already a conversion defined in core. But the conversion in core doesn't actually handle the conversion that I'm trying to define! Huh?)

At this point, I'm 100% stumped. Is there any way to use thiserror to have a custom error type that works automatically with ? without needing map_err()s everywhere that do nothing but call into()? Or to implement From for std::error::Error for something that, itself, implements std::error::Error?

Perhaps this has nothing to do with thiserror, and there's simply no way to do it in the language itself. But thiserror's docs hint at having transparent and adaptable error types, so I thought I'd at least ask before giving up on it.

created time in 2 months

issue commentJelteF/derive_more

derive custom Debug

I was looking for this exact thing last week and almost missed it! See #172.

mwillsey

comment created time in 2 months

PR opened JelteF/derive_more

Add documentation for DebugCustom derive

Per the comments in #68, this was missing from the docs.

I don't think the code in the doc/ docs runs under cargo test, but I did check that my additions compile, run, and pass.

+21 -2

0 comment

2 changed files

pr created time in 2 months

push eventdetly/derive_more

Jason Heeris

commit sha 0f5410b2f912ab4ce6f863734b7ea7a31e640160

Add DebugCustom to Display-like derive list in README.md.

view details

Jason Heeris

commit sha f59272953466b3de7c5575af40dd67119a866c63

Added note about DebugCustom to display-like trait docs.

view details

push time in 2 months

push eventdetly/derive_more

Jason Heeris

commit sha c308324a4ac6b1abf969be62e9b0792a874e9623

Add DebugCustom to Display-like derive list in README.md.

view details

Jason Heeris

commit sha f13f22fa04358d1e026f074c47b27349207e763d

Added note about DebugCustom to display-like trait docs.

view details

push time in 2 months

push eventdetly/derive_more

Jason Heeris

commit sha 8a9bcefe35d56cd19a522a8a29394dda5a439887

Add DebugCustom to Display-like derive list in README.md.

view details

Jason Heeris

commit sha 775f6c0ec8f523b8576fab7ad3de199f4d27abd3

Added note about DebugCustom to display-like trait docs.

view details

push time in 2 months

more