SShortSingh.
Back to feed

Cockatrice MTG Client Bug Silently Wiped Deck Files on Full Disks

0
·1 views

A bug in Cockatrice, the open-source Magic: The Gathering client, caused deck files to be permanently destroyed when saving to a full disk, with the app falsely reporting success. The issue, filed as #6952 by user Mekkiss, stemmed from three compounding failures in the DeckLoader::saveToFile() function: the file was truncated to zero bytes the moment it was opened for writing, serializers returned success unconditionally without verifying data was written, and the return value of flush() was discarded rather than checked. Because truncating a file frees rather than requires disk space, the open() call succeeded even on a full drive, wiping the existing deck before any new data could be written. Two additional write paths in the codebase shared the same flawed pattern, meaning a deck could be silently zeroed simply by opening it, without ever pressing save. The bug was traced and documented with fixes proposed for all three affected functions to properly validate write operations before reporting success.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer cuts Claude Design sync cost from 665k tokens to near zero with custom CLI

A developer reverse-engineered the undocumented API behind Claude.ai/design after finding that syncing project files through an AI agent consumed roughly 665,000 tokens — because all file bytes had to pass through the model's context. Since the endpoint is an undocumented MCP server, the developer mapped its behavior through direct observation rather than relying on any official specification. The process exposed three incorrect assumptions about the protocol, including how write results are structured, how access errors are surfaced, and how binary files are detected. To prevent untested assumptions from hiding real bugs, every documented protocol claim was paired with a live integration test that hits the actual server. The resulting CLI tool syncs files like a version-control system, keeping file bytes out of the model context entirely and using atomic writes to prevent data loss from interrupted operations.

0
ProgrammingDEV Community ·

Distributed Locks Can Expire Correctly and Still Corrupt Data Without Fencing Tokens

A distributed lock expiring on schedule does not prevent data corruption if a paused worker resumes and overwrites a newer update after its lease has already been claimed by another process. This is because distributed locks are effectively leases — they communicate ownership for a time window but cannot cancel in-flight writes or recall delayed network packets. A real-world parallel is the 2012 GitHub outage, where a ~90-second network disruption caused multiple file-server pairs to simultaneously believe they were the active owner of the same resource, requiring over five hours of recovery. The reliable fix is a fencing token: a strictly increasing integer issued by the lock coordinator on each acquisition, which the protected resource uses to reject any write carrying an older generation number. Unlike a random UUID — which only prevents an expired holder from releasing another's lock — a fencing token enforced at the storage layer ensures stale writes are rejected regardless of network or process delays.

0
ProgrammingDEV Community ·

Why Experienced AI Engineers Focus on Systems, Not Just Models

A machine learning practitioner has shared a key insight from their experience: building better AI models alone does not guarantee a successful AI product. In real-world production environments, the model is just one component surrounded by data pipelines, monitoring, logging, feedback loops, and deployment infrastructure. The author illustrates this with a comparison of two companies, where the one investing in robust system design consistently outperforms the one chasing marginal accuracy gains. This perspective shifts the focus from chasing the latest research benchmarks to mastering disciplines like MLOps, system design, and data engineering. The core takeaway is that users experience the entire system, not the model itself, making reliable system architecture the true foundation of useful AI products.

0
ProgrammingDEV Community ·

How One Practitioner Earned the Google Associate Data Practitioner Certification

A data analytics professional has shared their experience earning the Google Associate Data Practitioner certification through Google Cloud's structured Data Analytics Certificate program, which spans five courses. The candidate completed the program over several months, covering topics such as BigQuery, data lakehouse architecture, data governance, and cloud-native visualization. Preparation focused on applying concepts to real-world scenarios rather than rote memorization, since the exam consists entirely of multiple-choice questions testing practical skills. Hands-on labs, video lectures from Google instructors, and practice quizzes helped the candidate consistently meet the required 80% passing threshold on graded assessments. The writer describes the certification as a strong entry point into Google Cloud's data ecosystem and recommends full participation in all available lab work for those starting out.

Cockatrice MTG Client Bug Silently Wiped Deck Files on Full Disks · ShortSingh