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

[bug] productName with "@handle" won't build #5233

Closed
K4CZP3R opened this issue Sep 19, 2022 · 6 comments
Closed

[bug] productName with "@handle" won't build #5233

K4CZP3R opened this issue Sep 19, 2022 · 6 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@K4CZP3R
Copy link

K4CZP3R commented Sep 19, 2022

Describe the bug

If the productName contains /, it won't build.

"package": {
    "productName": "@test/test-app",

in tauri.conf.json

It results in the following error:

Error failed to rename `/Users/xxx/Documents/dev/xxx/src-tauri/target/release/app` to `/Users/xxx/Documents/dev/xxx/src-tauri/target/release/@test/test-app`: No such file or directory (os error 2)

Reproduction

  1. Create project
  2. Name it with so it starts with @test/
  3. build it

Expected behavior

After build, app name should be correctly handled by escaping / inside the productName

Platform and versions

Environment
› OS: Mac OS 12.6.0 X64
› Node.js: 16.17.0
› npm: 8.15.0
› pnpm: 7.11.0
› yarn: 1.22.17
› rustup: 1.25.1
› rustc: 1.63.0
› cargo: 1.63.0
› Rust toolchain: stable-aarch64-apple-darwin

Packages
› @tauri-apps/cli [NPM]: 1.1.1
› @tauri-apps/api [NPM]: 1.1.0
› tauri [RUST]: 1.1.1,
› tauri-build [RUST]: 1.1.1,
› tao [RUST]: 0.14.0,
› wry [RUST]: 0.21.1,

App
› build-type: bundle
› CSP: unset
› distDir: ../build
› devPath: http://localhost:10001/
› bundler: Rollup

App directory structure
├─ dev-build
├─ out
├─ node_modules
├─ public
├─ src-tauri
├─ build
├─ .git
├─ raw
└─ src

Stack trace

thread '<unnamed>' panicked at 'failed to rename app: failed to rename `/Users/kacper/Documents/dev/plu-v2-web/src-tauri/target/debug/app` to `/Users/kacper/Documents/dev/plu-v2-web/src-tauri/target/debug/@test/test-app`

Caused by:
    No such file or directory (os error 2)', src/interface/rust/desktop.rs:41:58
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Additional context

tauri info reports X64, but I'm running M1

@K4CZP3R K4CZP3R added status: needs triage This issue needs to triage, applied to new issues type: bug labels Sep 19, 2022
@amrbashir
Copy link
Member

After build, app name should be correctly handled by escaping / inside the productName

Do you mean changing all / to -? or do you want to create a subdir with the app name under the org name so the structure would be like this

release/
  |__@handle/
    |__ test-app

@K4CZP3R
Copy link
Author

K4CZP3R commented Sep 21, 2022

I've expected it to go like you said:

release/
  |__@handle/
    |__ test-app

@amrbashir
Copy link
Member

can you try the fix in #5262, change tauri and tauri-build deps in src-tauri/Cargo.toml to this

[build-dependencies]
tauri-build = { git = "https://github.com/tauri-apps/tauri", branch = "fix-namespaced-productname" }

[dependencies]
tauri= { git = "https://github.com/tauri-apps/tauri", branch = "fix-namespaced-productname" }

then run cargo update in src-tauri and try to build again

@K4CZP3R
Copy link
Author

K4CZP3R commented Sep 23, 2022

Btw, this is correctly handled when using npm create tauri-app for creating your app. In the wizard it's not possible to create package name with the handle.

✘ Package name should only include alphanumeric character and hyphens "-" and doesn't start with numbers

@K4CZP3R
Copy link
Author

K4CZP3R commented Sep 23, 2022

can you try the fix in #5262, change tauri and tauri-build deps in src-tauri/Cargo.toml to this

[build-dependencies]
tauri-build = { git = "https://github.com/tauri-apps/tauri", branch = "fix-namespaced-productname" }

[dependencies]
tauri= { git = "https://github.com/tauri-apps/tauri", branch = "fix-namespaced-productname" }

then run cargo update in src-tauri and try to build again

It still returns error, but maybe it should not be allowed when the wizard is not allowing it too?

My tauri.conf.js
{
  "build": {
    "beforeDevCommand": "",
    "beforeBuildCommand": "",
    "devPath": "../src",
    "distDir": "../src",
    "withGlobalTauri": true
  },
  "package": {
    "productName": "@handle/tauri-app",
    "version": "0.0.0"
  },
  "tauri": {
    "allowlist": {
      "all": true
    },
    "bundle": {
      "active": true,
      "category": "DeveloperTool",
      "copyright": "",
      "deb": {
        "depends": []
      },
      "externalBin": [],
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/128x128@2x.png",
        "icons/icon.icns",
        "icons/icon.ico"
      ],
      "identifier": "cxom.tauri.dev",
      "longDescription": "",
      "macOS": {
        "entitlements": null,
        "exceptionDomain": "",
        "frameworks": [],
        "providerShortName": null,
        "signingIdentity": null
      },
      "resources": [],
      "shortDescription": "",
      "targets": "all",
      "windows": {
        "certificateThumbprint": null,
        "digestAlgorithm": "sha256",
        "timestampUrl": ""
      }
    },
    "security": {
      "csp": null
    },
    "updater": {
      "active": false
    },
    "windows": [
      {
        "fullscreen": false,
        "height": 600,
        "resizable": true,
        "title": "tauri-app",
        "width": 800
      }
    ]
  }
}
My cargo.toml
[package]
name = "tauri-app"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
edition = "2021"
rust-version = "1.57"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html


[build-dependencies]
tauri-build = { git = "https://github.com/tauri-apps/tauri", branch = "fix-namespaced-productname", features = [] }



[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri= { git = "https://github.com/tauri-apps/tauri", branch = "fix-namespaced-productname", features = ["api-all"] }

[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]
Build log
...
   Compiling tauri-utils v1.1.1 (https://github.com/tauri-apps/tauri?branch=fix-namespaced-productname#1237d3c4)
   Compiling tauri-build v1.1.1 (https://github.com/tauri-apps/tauri?branch=fix-namespaced-productname#1237d3c4)
   Compiling tauri-codegen v1.1.1 (https://github.com/tauri-apps/tauri?branch=fix-namespaced-productname#1237d3c4)
   Compiling tauri-macros v1.1.1 (https://github.com/tauri-apps/tauri?branch=fix-namespaced-productname#1237d3c4)
   Compiling tauri-app v0.0.0 (/Users/kacper/Documents/dev/tauri-tset/tauri-app/src-tauri)
    Finished release [optimized] target(s) in 44.18s
       Error failed to rename `/Users/kacper/Documents/dev/tauri-tset/tauri-app/src-tauri/target/release/tauri-app` to `/Users/kacper/Documents/dev/tauri-tset/tauri-app/src-tauri/target/release/@handle/tauri-app`: No such file or directory (os error 2)

@amrbashir
Copy link
Member

amrbashir commented Sep 23, 2022

oh my bad, this bug was in the cli so you only need to

cargo install --git https://github.com/tauri-apps/tauri --branch fix-namespaced-productname tauri-cli

but after some more testing I found that having any of the following in /\:*?"<>| in the productName will make building msi on Windows crash so I think productName should be purely the app name without an org or namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants