GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — prevent ng build from overwriting source files · Issue #6485 · angular/angular-cli

prevent ng build from overwriting source files #6485

New issue
Copy link
New issue
Copy link
Open
Bug
Open
prevent ng build from overwriting source files#6485
Bug
Copy link
Labels
area: @angular-devkit/build-angularfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity2: inconvenienttype: bug/fix
Milestone
Backlog

Description

@netikras
netikras
opened on May 27, 2017
Issue body actions

Okay, that one was scarry as hell. I am sooo lucky I pushed my project to GH before building ng sources prepared for prod....

What I did was opening .angular-cli.json and setting
"outDir": "../../",

as I wanted to store built files next to my project so that I could simply exclude project in gradle. Turns out that was a terrible mistake as ng build --prod decided to nuked my whole UI project for good. Yes sir it did. 10 days of work have been completely vanished from my harddrive. Good thing is that I did push it all to git before...

I would strongly suggest to add safety switches preventing self-destruction in the whole ng-cli project.

Reacted by David Herges and José Toledo Navarro

Activity

  1. sumitarora
    self-assigned this
    on May 29, 2017
  2. sumitarora
    added
    command: build
    type: bug/fix
    on May 29, 2017
  3. filipesilva commented on May 31, 2017

    @filipesilva
    filipesilva
    on May 31, 2017
    Contributor
    More actions

    Heya, I'm really sorry about this happening. We do have such a safeguard but it seems to be broken:

    https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/tasks/build.ts#L24

    We'll fix it and make sure it doesn't break again, it seems we didn't test this correctly.

  4. filipesilva commented on May 31, 2017

    @filipesilva
    filipesilva
    on May 31, 2017
    Contributor
    More actions

    Actually, on second thought you say you put the outdir in the parent directory for the project... we don't really cater for that case. Maybe we could error out if the outdir is any part of the parent dirs.

  5. netikras commented on May 31, 2017

    @netikras
    netikras
    on May 31, 2017
    Author
    More actions

    Just an idea... what about creating lock files (hidden, of course) in build dir, right next to the files built? And if the lock is missing - warn user that everything in that directory will be erased and ask for confirmation (providing FULL PATH to outDir, because these dot-dot-slash-repeat notations might be very tricky sometimes; also symlinks here do not make life any easier). Kind of initializing build directory... Next time user is building its sources ng-cli would look for lock file in outDir and if it's present - delete everything in that directory w/o asking for any confirmations, then recreate the lock and build the project. if lock file name is constant (or can be overriden in configurations at will) it would be easy to exclude it if built files are to be processed further (e.g. gradle).

    Maybe I'm just paranoid after my experience, but I imagine someone might set outdir to /home/myuser/ and that would effectively destroy the user :) Also after my experience as Linux sysadmin I've learned that giving users an ability to remove anything is a very risky thing to do and mechanisms preventing the user from shooting its own feet must be in place :) Especially when that ability (to remove smth) is implicit...

    Or just restrict to some directory inside the project root. But then there's less flexibility :?

    Just chipping in my 2¢ :)

  6. filipesilva
    added
    P5The team acknowledges the request but does not plan to address it, it remains open for discussionThe team acknowledges the request but does not plan to address it, it remains open for discussion
    featureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues
    and removed
    type: bug/fix
    on Jun 1, 2017
  7. hansl
    unassigned
    sumitarora
    on Feb 1, 2018
  8. filipesilva
    removed
    P5The team acknowledges the request but does not plan to address it, it remains open for discussionThe team acknowledges the request but does not plan to address it, it remains open for discussion
    on Feb 1, 2018
  9. filipesilva
    added
    area: @angular-devkit/build-angular
    and removed
    comp: cli/build
    on Jun 8, 2018
  10. ngbot
    added this to the Backlog milestone on Jan 24, 2019
  11. filipesilva
    added
    freq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarely
    severity2: inconvenient
    type: bug/fix
    and removed
    featureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues
    on Oct 1, 2019
  12. kyliau
    changed the title [-]built-in ng project self destruction functionality[/-] [+]prevent ng build from overwriting source files[/+] on May 26, 2020
  13. kyliau
    added
    triage #1
    on May 26, 2020
  14. alan-agius4
    removed
    triage #1
    on Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular-devkit/build-angularfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity2: inconvenienttype: bug/fix

    Type

    Bug

    Projects

    No projects

      Milestone

      • BacklogNo due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.