tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
84.66k stars 2.54k forks source link

[bug] [v2] Identifier without a dot (.) causes a crash on Linux #10353

Open VPKSoft opened 3 months ago

VPKSoft commented 3 months ago

Describe the bug

An app with identifier in the src-tauri/tauri.conf.json without a single . / dot character causes a program crash in Linux. Working identifier: "identifier": "WhatEver.Identifier", failing identifier: "identifier": "WhatEverIdentifier", The program is just a standard template created with npm create tauri-app@latest -- --beta command.

Reproduction

  1. Use Ubuntu Linux 22.04 (will reproduce with others also)
  2. Create a program with npm create tauri-app@latest -- --beta -command with the following selections:
    ✔ Project name · tauri-gtk
    ✔ Choose which language to use for your frontend · TypeScript / JavaScript - (pnpm, yarn, npm, bun)
    ✔ Choose your package manager · npm
    ✔ Choose your UI template · React - (https://react.dev/)
    ✔ Choose your UI flavor · TypeScript
    ✔ Would you like to setup the project for mobile as well? · yes
  3. Change the identifier in the src-tauri/tauri.conf.json to a string without dots (. characters).
  4. Install npm packages with npm i
  5. Run the program: npm run tauri dev

Expected behavior

The program should run and display a window with some content.

Full tauri info output

[✔] Environment
    - OS: Ubuntu 22.04 X64
    ✔ webkit2gtk-4.1: 2.44.2
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.79.0 (129f3b996 2024-06-10)
    ✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 22.5.1
    - npm: 10.8.2

[-] Packages
    - tauri [RUST]: 2.0.0-beta.24
    - tauri-build [RUST]: 2.0.0-beta.19
    - wry [RUST]: 0.41.0
    - tao [RUST]: 0.28.1
    - @tauri-apps/api [NPM]: 2.0.0-beta.15
    - @tauri-apps/cli [NPM]: 2.0.0-beta.22

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

(process:60700): Gtk-CRITICAL **: 19:36:28.907: gtk_application_new: assertion 'application_id == NULL || g_application_id_is_valid (application_id)' failed
thread 'main' panicked at /home/billythecat/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gtk-0.18.1/src/auto/application.rs:13:1:
assertion failed: !ptr.is_null()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Additional context

I have tested that the program works in such case in both Windows and macOS correctly, also this works with Tauri v1 including Linux.

pewsheen commented 3 months ago

I suspect it's because the identifier isn't valid for a newer version of gtk. g_application_id_is_valid()

  • Application identifiers must contain at least one . (period) character (and thus at least two elements).
VPKSoft commented 3 months ago

I suspect it's because the identifier isn't valid for a newer version of gtk. g_application_id_is_valid()

  • Application identifiers must contain at least one . (period) character (and thus at least two elements).

Okay, the note while hovering over the identifier in the tauri.conf.json sort of says the same thing, only the required part is missing:

The application identifier in reverse domain name notation (e.g. `com.tauri.example`).
This string must be unique across applications since it is used in system configurations like
the bundle ID and path to the webview data directory.
This string must contain only alphanumeric characters (A–Z, a–z, and 0–9), hyphens (-),
and periods (.).